-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error handling in getLatestPackageSetsTag could be improved #687
Comments
I believe that (i.e. I did not look at the code yet) if we go for the strategy described in #657 (comment) then we can probably just get rid of all this code that gets the latest package set tag? This is because the work of getting the latest set is already being done by the However @nwolverson introduced the possibility to upgrade alternate package sets in #671 (which also introduces some of the logs you refer to), which means that Spago suddenly needs to support arbitrary repos containing sets - this means that there should be a way to support them. I think we have a couple of paths here:
My preferred option would be 1, because it's a much neater solution going forward and it's less terrible code to maintain (I'm really not proud of this part of the codebase 😄) |
Option 1 sounds good to me, although I think we might want the fallback behaviour to differ based on whether we are within |
This is the current behaviour - but this would mean keeping around this code hitting GitHub right? |
Right, but that doesn't seem too bad to me. We need to hit GitHub to get the latest-compatible-sets.json file anyway, so I think the new code probably won't differ all that much - at least, in the version of it that I'm imagining. |
@hdgarrood there is a difference: we won't get ratelimited when hitting the So the main issue I have with the current code here is not that it looks ugly, but that it doesn't work reliably. |
There are a couple of slight oddities with the error handling in Spago.GitHub.getLatestPackageSetsTag.
Firstly, in getLatestRelease1 (the one which uses the GitHub API), if the request fails, the string "rel1" is prepended to the message which is logged as a warning (i.e. is visible without passing the -v flag). If you turn off your wifi / unplug your ethernet cable, delete (or temporarily rename) your global cache, and run
spago init
, you get output like this:which seems unintentional. The string
rel2
is included in a debug message in getLatestRelease2, which suggests that maybe therel1
was intended to be a debug message too.Secondly, the errors are printed unconditionally, which means that if they all fail you get five errors printed (or ten, with
-v
). Since it's not actually fatal if all of these attempts to fetch the latest tag file fail, perhaps we should turn all of these warning log messages into debug log messages, and also only log the last failure if they all fail? I think only logging the last failure if they all fail may have been the intention at one point anyway, judging by lines 84-86:(note that the retrying happens inside
downloadTagToCache
).The text was updated successfully, but these errors were encountered: