From 105bf5407c8fcc96509c11367af0980d2c4cfb79 Mon Sep 17 00:00:00 2001 From: Abhinav Nekkanti <10552725+anekkanti@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:25:35 -0800 Subject: [PATCH] Increase the jitter on the retry interceptor. (#174) --- internal/client/client.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/client/client.go b/internal/client/client.go index a4536bc..428ab8a 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -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), ), ), },