-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Describe the bug
In the RateLimit demo code a TimeSpan.Seconds is used to report the delay in the console. The TimeSpan.Seconds goes to 59 seconds and then starts over with 0 seconds. Thus if a delay of 70 seconds is calculated or returned in the response header then the RateLimit demo reports this as 10 seconds instead of 70 seconds.
To Reproduce
Configure and compile the app from:
https://github.com/OneDrive/samples/tree/master/scenarios/throttling-ratelimit-handling/RateLimitDemo
Expected behavior
If a delay of 120 seconds is returned or calculated, then this should be reported as 120 seconds instead of 0 seconds.
Screenshots
Details
Exact places in code:
samples/scenarios/throttling-ratelimit-handling/RateLimitDemo/ThrottlingHandler.cs
Line 84 in 71ca083
| AnsiConsole.MarkupLine($"[red]Throttling {apiType} request, waiting for {waitTime.Seconds} seconds[/]"); |
| AnsiConsole.MarkupLine($"[orange3]Delaying {apiType} request for {new TimeSpan(delayInTicks).Seconds} seconds, capacity left: {capacityLeft}%[/]"); |
Additional context
We had using TimeSpan.Seconds to log the RateLimit and Throttling delay. It was until we compared the log with a Fiddler log that this issue has come clear to us. It can easily be solved by using the TotalSeconds property.
