extendLease

abstract suspend fun extendLease(by: Duration)

Renews this run's lease so that it now lasts by from the store's current time.

The lease only tells other workers that this one is alive: the runtime renews it automatically every heartbeat interval for as long as this attempt is in flight, and handler duration is bounded only by the per-kind timeout (see JobRegistry.handle), never by the lease. Call this ahead of a single blocking operation that could starve the heartbeater or outlast a lease by more than one heartbeat interval, passing a value that covers the whole operation.

Per the store contract, a lease that has already expired cannot be renewed, not even by its former holder: another worker may already have revived the job with a higher fence, and this attempt's completion write will then be rejected. That is the documented at-least-once case, not an error.