Skip to content
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 a pop method for CountByIntervalAwaitableConstraint._TimeStamps #28

Open
MatthewSteeples opened this issue Nov 25, 2020 · 0 comments

Comments

@MatthewSteeples
Copy link

This is quite an unusual scenario so this may not be the best way to resolve it, but it was one of my first ideas so I thought it was worth raising.

Scenario: We're working with an API that allows us to make 60 requests over a 60 second period. Additionally, the API returns to us (via an HTTP header) how many requests we have left, although it does not inform us when the number will be increasing. That's nice and straightforward so far. Where it gets interesting is that for the first 30 minutes of a new authorisation (new customer being onboarded) there are no limits. During this period, the HTTP header will always return 60.

Problem: We don't know at the time of making the first request (without some serious re-engineering) whether the connection is within this 30 minute window or not

Proposed Solution: If there was a method that would enable us to Pop the oldest item off the TimeStamps collection then when we got the response back, we could look at our remaining requests and if it's 60 then we could then tell the TimeLimiter to not remember that value (so it won't enforce a delay later on)

If you're happy with this kind of method being added then I'm happy to work on the implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant