Skip to content

Commit

Permalink
Increase the jitter on the retry interceptor. (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
anekkanti authored Nov 14, 2024
1 parent 0b8f167 commit 105bf54
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ func NewConnectionWithAPIKey(addrStr string, allowInsecure bool, apiKey string)
HostPort: addrStr,
ConnectionOptions: client.ConnectionOptions{
DialOptions: []grpc.DialOption{
// Make sure to keep this a chain interceptor and make this a inner interceptor.
// This will make sure to exercise this retry before the retry interceptor in the SDK.
// TODO (abhinav): Move this retry interceptor to the SDK.
grpc.WithChainUnaryInterceptor(
grpcretry.UnaryClientInterceptor(
// max backoff = 64s (+/- 32s jitter)
grpcretry.WithBackoff(
grpcretry.BackoffExponentialWithJitter(250*time.Millisecond, 0.1),
grpcretry.BackoffExponentialWithJitter(500*time.Millisecond, 0.5),
),
grpcretry.WithMax(5),
grpcretry.WithMax(7),
),
),
},
Expand Down

0 comments on commit 105bf54

Please sign in to comment.