Skip to content

withLeaseOn

withLeaseOn<A, E, R>(store, options): Effect<Option<A>, E | LeaseFailure, R>

Defined in: packages/core/src/session/lease.ts:63

Holds a session’s writer lease for the duration of use.

The lease renews on a schedule. Each renewal is recorded before the next wait, so a lost lease is visible to use while it is still running. A store error does not stop the renewal loop: the lease is only reported lost once a renewal has failed for longer than its TTL, so one transient failure does not abort healthy work and a persistent failure cannot hide behind a stale lost flag. update also checks the owner inside the store, in the same transaction as the version.

A

E

R

StrongMessageSessionStore

LeaseOptions<A, E, R>

Effect<Option<A>, E | LeaseFailure, R>