Skip to content

RateLimit demo app reports Seconds instead of TotalSeconds #89

@digiofficerobin

Description

@digiofficerobin

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

Image

Details
Exact places in code:

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions