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

Handle rate-limit edge case #911

Merged

Conversation

martincostello
Copy link
Member

The issue or feature being addressed

If a large numberOfExecutions value (e.g. int.MaxValue) is used with a small perTimeSpan value, the division between the two will create a number too small to be represented by a tick, ending up with a TimeSpan.Zero value.

This then created a confusing exception message saying that the user had specified TimeSpan.Zero, when they hadn't.

Found while creating a "big enough" rate limit to use for the benchmarks in #910.

Details on the issue fix or feature implementation

Improved the exception message by throwing a specific exception if onePer ends up with a zero or negative value once computed.

Confirm the following

  • I started this PR by branching from the head of the latest dev vX.Y branch, or I have rebased on the latest dev vX.Y branch, or I have merged the latest changes from the dev vX.Y branch
  • I have targeted the PR to merge into the latest dev vX.Y branch as the base branch
  • I have included unit tests for the issue/feature
  • I have successfully run a local build

If a large numberOfExecutions value (e.g. int.MaxValue) is used with a small perTimeSpan value, the division between the two will create a number too small to be represented by a tick, ending up with a TimeSpan.Zero value.
This then created a confusing exception message saying that the user had specified TimeSpan.Zero, when they hadn't.
Improved the exception message by throwing a specific exception if onePer ends up with a zero or negative value once computed.
@martincostello martincostello added this to the v7.3.0 milestone Jan 17, 2022
@martincostello martincostello merged commit 197c5d3 into App-vNext:v723-or-v730 Jan 17, 2022
@martincostello martincostello deleted the Rate-Limit-Fixes branch January 17, 2022 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant