microsoftgraph / microsoftgraph/msgraph-sdk-dotnet
Add option to disable in-memory retries of throttling while keeping other retries
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 789
- Forks
- 264
- Avg merge
- 15h 17m
- Merged PRs (30d)
- 3
Description
Is your feature request related to a problem? Please describe the problem.
Working on an heavy background processing service, we have to make a lot of requests to the Graph Api. The default RetryHandler provided with the SDK will Task.Delay for the duration of the "retry-after" header leading to our task pipeline being idle for a significant amount of time.
Wanting to improve the throughput of our system, we decided to implement a custom mechanism to handle throttling which allows us to process other tenants while considering the "retry-after" delay suggested by the Graph Api for this tenant. Since we have an alternative, we would like to opt-out of the default retries from the SDK.
With the current settings exposed by the Graph SDK, the only option for removing the default throttling retries is to set the "MaxRetry" to 0. This has as a side effect to also remove the retries for 504s (which are not documented as being throttling).
Describe the solution you'd like.
Have a way to disable the default retries on throttling while keeping other default retries in the SDK.
I tried to do it with the "ShouldRetry" option, but, similar to this other case, the short circuit operator in place for throttling is being invoked before that method, leading to the ShouldRetry method being ignored for throttling.
I tried inheritance on the RetryHandler as a way to overwrite the short circuit operator itself but the method is private. For it to work, one would have to overwrite the SendAsync and SendRetryAsync methods but it comes at the cost of opting out of code maintained by the SDK/Kiota.
Additional context?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Kiota's src/Middleware/RetryHandler.cs, especially SendAsync, SendRetryAsync, and the private throttling decision referenced in the issue. Review the Graph SDK RetryHandlerOption and ShouldRetry behavior described in the linked documentation. Done means callers can disable throttling retries while retaining other default retries such as those for 504 responses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100