taskq
taskq copied to clipboard
Prevent exponential backoff delay from overflowing
Because of the bit shifting used in the exponential backoff computation, an overflow can happen given some specific values for min/max backoff.
Here is a snippet to show the current and fixed behavior: https://go.dev/play/p/V2tno9piKly
This PR fixes it without trying to change the "normal" behavior by simply using the max backoff value when an overflow happens.
@skateinmars I think you can move the code from https://go.dev/play/p/V2tno9piKlk to a test https://github.com/vmihailenco/taskq/blob/v3/consumer_test.go