TimePeriodLockService

uk.gov.hmrc.mongo.lock.TimePeriodLockService
See theTimePeriodLockService companion object

For locking for a give time period (i.e. stop other instances executing the task until it stops renewing the lock). The lock will be held on to when the task has finished, until it expires.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def withRenewedLock[T](body: => Future[T])(implicit ec: ExecutionContext): Future[Option[T]]

Runs body if a lock can be taken or if the existing lock is owned by this service instance. The lock is not released at the end of but task (unless it ends in failure), but is held onto until it expires.

Runs body if a lock can be taken or if the existing lock is owned by this service instance. The lock is not released at the end of but task (unless it ends in failure), but is held onto until it expires.

Attributes

Abstract fields

val lockId: String
val ttl: Duration