juju / mutex

Provides a named machine level mutex shareable between processes.
Other
28 stars 11 forks source link

Permit exponential backoff #2

Closed voidspace closed 7 years ago

voidspace commented 7 years ago

It should be possible to have exponential back-off (could be a bool on Spec) up to a maximum delay (MaxDelay on Spec - if 0 then no max in the backoff). If Exponential is True then "Delay" is the initial delay, with the delay doubling on each acquire poll.

rogpeppe commented 7 years ago

Adding options to tweak timing strategy seems like it should be out of the scope of this package. We already have packages focused exactly on retries. Given that no lock implementions block, why not make this a "fail immediately" API with no configuration and leave the retrying for some place external such as juju/utils?

mjs commented 7 years ago

+1 to what @rogpeppe said. Let's figure out how to reuse our existing retry approaches here.

axw commented 7 years ago

This is irrelevant now, since the mutexes are now blocking. There's still a delay for compatibility with old implementations, but working in backoff is overkill.