Skip to content
Discussion options

You must be logged in to vote

I think that's probably fine, except that the jitter doesn't guarantee the rate limit. e.g. If you do 5 rps, and the random.random() calls average <0.5 (i.e. 50% of the time), then you'll end up doing 6 rps and trigger the rate limit.

It also assumes you don't want to handle bursty behaviour (e.g. we've had cases where we have something like 10 requests per minute rate limit, but we get bursts of 5 requests we want to make. With your code, the 5th request would be delayed 30 seconds when it could have been made immediately).

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@loic-bellinger
Comment options

@Dreamsorcerer
Comment options

Answer selected by loic-bellinger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants