Skip to content

Commit

Permalink
Fix jitter panics with invalid argument to Int63n
Browse files Browse the repository at this point in the history
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
  • Loading branch information
ktock committed Feb 22, 2022
1 parent 479f541 commit 0abfeab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/remote/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ type fetcherConfig struct {
}

func jitter(duration time.Duration) time.Duration {
if duration <= 0 {
return duration
}
return time.Duration(rand.Int63n(int64(duration)) + int64(duration))
}

Expand Down

0 comments on commit 0abfeab

Please sign in to comment.