NServiceBus.Persistence.Sql
NServiceBus.Persistence.Sql copied to clipboard
Randomize outbox cleanup sleep duration and/or add jitter to decrease running cleanup on multiple instances concurrently
Describe the suggested improvement
Currently, the sleep interval for outbox cleanup is fixed. A user reported that often this causes issue just after a deployment of a new version as all instances are pretty much aligned on the sleep duration.
To minimize overlap in cleanup it could
- Have a random delay on the first outbox cleanup (for example rnd(1)*CleanupInterval)
- Add jitter to each sleep to decrease the change of running cleanup on multiple instances (for example CleanupInterval/2 + rnd(1)CleanUpInterval)
Additional Context
No response