uk.gov.hmrc.mongo.lock.ScheduledLockService
See theScheduledLockService companion object
trait ScheduledLockService
A locking implementation for scheduled tasks that will only execute the body when a new lock has been acquired.
The lock's ttl is set to be schedulerInterval + 1 second, meaning that the instance that currently owns the lock will always have a chance to refresh the lock and extend the ttl.
If the lock is successfully refreshed, then body will not be executed, as being able to refresh the lock signals that the body of the previous invocation hasn't yet completed.
Once the body has completed it will either:
- Release the lock immediately, when the
bodyhas taken longer than theschedulerIntervalto complete - Disown the lock and amend the ttl to reflect the cadence of the scheduled task
In the event that the scheduled task ends in failure, the lock will be released immediately.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
In this article