nikesh.krishnan | 6dd882b | 2023-03-14 10:02:41 +0530 | [diff] [blame] | 1 | // Copyright 2016 Michal Witkowski. All Rights Reserved. |
| 2 | // See LICENSE for licensing terms. |
| 3 | |
| 4 | /* |
| 5 | `grpc_retry` provides client-side request retry logic for gRPC. |
| 6 | |
| 7 | Client-Side Request Retry Interceptor |
| 8 | |
| 9 | It allows for automatic retry, inside the generated gRPC code of requests based on the gRPC status |
| 10 | of the reply. It supports unary (1:1), and server stream (1:n) requests. |
| 11 | |
| 12 | By default the interceptors *are disabled*, preventing accidental use of retries. You can easily |
| 13 | override the number of retries (setting them to more than 0) with a `grpc.ClientOption`, e.g.: |
| 14 | |
| 15 | myclient.Ping(ctx, goodPing, grpc_retry.WithMax(5)) |
| 16 | |
| 17 | Other default options are: retry on `ResourceExhausted` and `Unavailable` gRPC codes, use a 50ms |
| 18 | linear backoff with 10% jitter. |
| 19 | |
| 20 | For chained interceptors, the retry interceptor will call every interceptor that follows it |
| 21 | whenever when a retry happens. |
| 22 | |
| 23 | Please see examples for more advanced use. |
| 24 | */ |
| 25 | package grpc_retry |