Closed mreiferson closed 3 years ago
--- FAIL: TestFullJitterBackoff (0.00s) panic: invalid argument to Intn [recovered] panic: invalid argument to Intn goroutine 9 [running]: testing.tRunner.func1.2({0x82fcd00, 0x83aa4f8}) /usr/local/go/src/testing/testing.go:1209 +0x2ab testing.tRunner.func1(0xa0014a0) /usr/local/go/src/testing/testing.go:1212 +0x27d panic({0x82fcd00, 0x83aa4f8}) /usr/local/go/src/runtime/panic.go:1038 +0x1c5 math/rand.(*Rand).Intn(0xa00ec00, 0xdcd65000) /usr/local/go/src/math/rand/rand.go:168 +0x7d github.com/nsqio/go-nsq.(*FullJitterStrategy).Calculate(0xa1061f8, 0x3) /__w/go-nsq/go-nsq/go/src/github.com/nsqio/go-nsq/config.go:75 +0xac
backoffDuration := s.cfg.BackoffMultiplier * time.Duration(math.Pow(2, float64(attempt))) return time.Duration(s.rng.Intn(int(backoffDuration)))
I think int(backoffDuration) ended up being 0 ?
int(backoffDuration)
0
... oh, wraparound, that would also do it
I'm not sure how this ever passed on 386?
well, that was fun
nice little fix for 32-bit architectures!
I think
int(backoffDuration)
ended up being0
?