Skip to content

Commit

Permalink
fix bug : should drain channel of timer after stop (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikenchina committed Aug 14, 2023
1 parent 36583ea commit a53adc7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion interceptors/retry/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ func waitRetryBackoff(attempt uint, parentCtx context.Context, callOpts *options
timer := time.NewTimer(waitTime)
select {
case <-parentCtx.Done():
timer.Stop()
if !timer.Stop() {
<-timer.C
}
return contextErrToGrpcErr(parentCtx.Err())
case <-timer.C:
}
Expand Down

0 comments on commit a53adc7

Please sign in to comment.