blob: afd924a1406afb712843bf821703f8f53bd2fb97 [file] [log] [blame]
nikesh.krishnanca4afa32023-06-28 03:42:16 +05301// 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
7Client-Side Request Retry Interceptor
8
9It allows for automatic retry, inside the generated gRPC code of requests based on the gRPC status
10of the reply. It supports unary (1:1), and server stream (1:n) requests.
11
12By default the interceptors *are disabled*, preventing accidental use of retries. You can easily
13override 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
17Other default options are: retry on `ResourceExhausted` and `Unavailable` gRPC codes, use a 50ms
18linear backoff with 10% jitter.
19
20For chained interceptors, the retry interceptor will call every interceptor that follows it
21whenever when a retry happens.
22
23Please see examples for more advanced use.
24*/
25package grpc_retry