From 0abfeab94505706e159ed138fcf458597ce78edb Mon Sep 17 00:00:00 2001 From: Kohei Tokunaga Date: Tue, 22 Feb 2022 12:10:00 +0900 Subject: [PATCH] Fix jitter panics with `invalid argument to Int63n` Signed-off-by: Kohei Tokunaga --- fs/remote/resolver.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/remote/resolver.go b/fs/remote/resolver.go index 3b7c250b2..74cd7b557 100644 --- a/fs/remote/resolver.go +++ b/fs/remote/resolver.go @@ -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)) }