From 9f4619204d8bcc2d93aa8c31ffa12162ce47d2a0 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Wed, 28 Sep 2022 12:40:02 -0700 Subject: [PATCH] [Internal] Documentation: Adds 429 mention on SDK design doc (#3476) --- docs/SdkDesign.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/SdkDesign.md b/docs/SdkDesign.md index 609d671186..e1be7d282a 100644 --- a/docs/SdkDesign.md +++ b/docs/SdkDesign.md @@ -29,7 +29,8 @@ flowchart UserHandlers <--> DiagnosticHandler DiagnosticHandler <--> TelemetryHandler TelemetryHandler <--> RetryHandler[Cross region retries] - RetryHandler <--> RouteHandler + RetryHandler <--> ThrottlingRetries[Throttling retries] + ThrottlingRetries <--> RouteHandler RouteHandler <--> IsPartitionedFeedOperation{{Partitioned Feed operation?}} IsPartitionedFeedOperation <-- No --> TransportHandler IsPartitionedFeedOperation <-- Yes --> InvalidPartitionExceptionRetryHandler @@ -38,6 +39,12 @@ flowchart TransportHandler <--> TransportClient[[Selected Transport]] ``` +## Throttling retries + +Any HTTP response, with a status code `429` from the service means the current operation is being [rate limited](https://learn.microsoft.com/azure/cosmos-db/sql/troubleshoot-request-rate-too-large) and it's handled by the [RetryHandler](../Microsoft.Azure.Cosmos/src/Handler/RetryHandler.cs) through the [ResourceThrottleRetryPolicy](../Microsoft.Azure.Cosmos/src/ResourceThrottleRetryPolicy.cs). + +The policy will retry the operation using the delay indicated in the `x-ms-retryafter` response header up to the maximum configured in `CosmosClientOptions.MaxRetryAttemptsOnRateLimitedRequests` with a default value of 9. + ## Cross region retries Any failure response from the Transport that matches the [conditions for cross-regional communication](https://docs.microsoft.com/azure/cosmos-db/troubleshoot-sdk-availability) are handled by the [RetryHandler](../Microsoft.Azure.Cosmos/src/Handler/RetryHandler.cs) through the [ClientRetryPolicy](../Microsoft.Azure.Cosmos/src/ClientRetryPolicy.cs).