update throttle handling with nldi for #759#762
Merged
ldecicco-USGS merged 1 commit intoDOI-USGS:mainfrom Apr 7, 2025
Merged
Conversation
Closed
Contributor
Author
|
@ldecicco-USGS -- this is my first time touching the httr2 implementation in here -- hope I didn't step in anything. |
Collaborator
|
Looks good! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm not totally satisfied with this, but I think it ticks the box for #759
I now see:
This won't send messages unless a user gets to within 90% of the overall rate limit. It won't sleep until the user is under 20 requests remaining in their allocation. The rate limit calculations are a black box so I was quite conservative with waiting 3x what should be technically possible. It seems like the rate limits accrue in some way differently from 1:1.
The way the rate limit header is listed, it shows the absolute limit and how many is left in that allocation. It does not say anything about the time base for the rate limit. For now, it's all based on a per hour allocation. We will try to stick to the hour basis going forward.