Closed kisom closed 8 years ago
I think this PR is the right direction: fixes RNG, make Jitter the default.
Some thoughts:
- Seed a package wide RNG on init, with /dev/urandom. I would prefer it crashing if reading randomness fails. My daemons will all be under process supervision, so transient errors should go away. Just relying on local time might bite us in case we do concurrent updates or similar.
:+1:
Kyle, Any comments? Which direction do you want to move with this?
@lmb:
The code was updated to address your concerns:
SetDurations
has been excisedNewWithoutJitter
function is now provided.In general, the latest code prefers the approach of creating a new Backoff
if parameters need to be changed.
LGTM once we figure out what to do about Tries()!
LGTM, squash?
Squashed.
Right now,
backoff
uses the global math/rand state for jitter. This change moves the random source into the Backoff structure.Additionally, the package currently tries to use a simple approach where initialisation happens on the fly. This doesn't provide a satisfactory method of handling the case where there is an error in setting up the RNG. This change requires initialisation via a
New
function, which returns an error if the RNG cannot be setup.