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
Handle 'None' return value of wait() properly during throttling. #6837
Conversation
Thanks @EnTeQuAk. Adding to the milestone. |
Thanks @EnTeQuAk! |
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.
Actually, on second thought, what's the correct behavior here? If throttle_durations = [None]
, this would still end up calling self.throttled(request, None)
, which doesn't seem right? Maybe the fix should be to .allow_request()
. It doesn't make sense for allow_request
to return False for the throttle to then return a None
wait value.
@rpkilby I believe this PR fixes the issue where If all throttles return |
I guess I'm asking if this makes sense:
Does it make sense for a throttle to say "hey, this request should be throttled", and then when we ask how long it should wait for it responds with ¯\_(ツ)_/¯ For context, I'm not incredibly familiar with the throttling internals, which is why I'm asking. |
(I wrote the patch causing this issue)
Yes. You might not want to tell clients how long they should wait. Or you might not even know the exact answer (it's a guess anyway, a recommendation, nothing more), depending on the implementation. What threw me off when I wrote the initial patch was that, even though I had this in mind, I forgot that you could mix throttles that do return a duration and ones that don't (completely glossed over the fact that |
Many thanks for the response @diox. |
Fixes #6836