-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add check in main.py for hitting the ratelimit #6
base: master
Are you sure you want to change the base?
Conversation
remaining = json['resources']['core']['remaining'] | ||
return remaining | ||
|
||
if test_rate() == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit aggressive; can't we just check if we got an error (on the request), and then report it?
Why would we have to explicitly check for errors independently of the actual request?
I feel this adds a https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just felt it was cleaner. Idk though.
Well, it would fix the issue of throwing errors when you hit that rate limit, if you were authenticated, afaik, there is a much higher cap on your rate limit. |
I don't think it fixes anything; it's merely a temporary workaround. But even then it makes it harder to catch these errors because it's hard to catch the hard
Yes, but if you aren't authenticated, last I checked, for this API (or the resulting URLs), the limit was... (in practice) 0 requests. Until we add authentication, there is no way this script could work. So this is not a rate-limiting issue, but an authentication issue. Once we add authentication we might hit rate-limits, but then I still think that it should be handled differently for the problems I described in my review comments (TOCTOU) and elsewhere. The check is too specific for one type of problem, so we'd be playing cat-and-mouse when other kind of errors arise. We should be able to handle errors when they arise, rather than speculatively checking if they might happen. |
Oh, I misunderstood #4 lol. I get what you mean now. |
Temp fix for #4 in main.py
(#5 does the same thing but for artifact_lib.py)