Hi!
Love the quality across the library!
Issue
This is very much a tentative bug report (I'm a novice in Go), and even if my interpretation is correct, this probably won't affect any sane real-world use cases due to a low base/error count.
That said, wouldn't this still be able to overflow? (for example if retrySecondsWithoutJitter returns maxDurationSeconds - 1)
Proposed fix
I'd add a clamping step after applying the jitter.
Adjacent simplificaton
Here the comments drifted from implementation, if I understood this correctly, attempt == (errorCount + 1) in all cases a job is retried or rescued and the real reason is backward compatibility with versions that wouldn't restore the pre-fetch attempt value on snooze. This is the comment we used in our port:
// In modern versions of River this is the same number as `attempt`, however in older version snoozing a job wouldn't
// restore its attempt count to the pre-fetch value, and that would lead to incorrect retry durations when jobs are
// first snoozed, then retried. To avoid this and keep backward compatibility, the number of errors are used instead.
No real dent, just wanted to chip in where I could. :)
Thanks for your work,
– Dani
Hi!
Love the quality across the library!
Issue
This is very much a tentative bug report (I'm a novice in Go), and even if my interpretation is correct, this probably won't affect any sane real-world use cases due to a low base/error count.
That said, wouldn't this still be able to overflow? (for example if retrySecondsWithoutJitter returns maxDurationSeconds - 1)
Proposed fix
I'd add a clamping step after applying the jitter.
Adjacent simplificaton
Here the comments drifted from implementation, if I understood this correctly, attempt == (errorCount + 1) in all cases a job is retried or rescued and the real reason is backward compatibility with versions that wouldn't restore the pre-fetch attempt value on snooze. This is the comment we used in our port:
No real dent, just wanted to chip in where I could. :)
Thanks for your work,
– Dani