In the name of resilience, I changed the behavior in case of zero or negative sleep time: we do not try any more to be smart, we fall-back to the default back-off sequence. In particular, have a close look at the tests. I arrived at this approach after many attempts, but for sure I might have missed something, so we can change if needed.
To keep things simple and incremental, the new retry mechanism does not support jitter. I think this can be safely added back later.
Best reviewed commit per commit:
Note that:
Part of PCI-3309.