Skip to content

Commit 4b47527

Browse files
committed
add pause before read retry
1 parent d98028f commit 4b47527

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/topic/topicreaderinternal/stream_reconnector.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,19 @@ func (r *readerReconnector) ReadMessageBatch(ctx context.Context, opts ReadMessa
7878
return nil, ctx.Err()
7979
}
8080

81+
attempt := 0
82+
8183
for {
84+
if attempt > 0 {
85+
select {
86+
case <-ctx.Done():
87+
return nil, ctx.Err()
88+
case <-backoff.Fast.Wait(attempt):
89+
// pass
90+
}
91+
}
92+
93+
attempt++
8294
stream, err := r.stream(ctx)
8395
switch {
8496
case topic.IsRetryableError(err):

0 commit comments

Comments
 (0)