Skip to content

BackOffHandler to honor retryAfter value in case of rateLimitExceeded #2715

Description

@SangeethaJanakiraman

We are using BackoffHandler https://github.com/googleapis/google-api-dotnet-client/blob/55e00d18f4024a44f7007a3dbfaf6fcba4ed67f5/Src/Support/Google.Apis.Core/Http/BackOffHandler.cs#L31 to retry the errors like ratelimitExceeded / userRateLimitExceeded.

But by default, it computes time to wait using exponential backoff logic. Google API sometimes gives the retryAfter value in case of 429 http status codes.
Ex. The service gmail has thrown an exception. HttpStatusCode is 429. User-rate limit exceeded. Retry after 2024-01-10T23:55:00.392Z

Is it possible to honor this Retryafter value in backOffHandler ?
Else we need to have multiple UnsuccessfulResponse handlers -
1. Default BackoffHandler for 429 or other codes without retryAfter
2. RetryAfterHandler - custom implementation to honor retry value to wait.

Please confirm if this enhancement can be possible from library side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions