CONCEPT · 10 MIN READ

Lease

A lease is time-limited ownership. If its owner stops renewing it, another worker may safely claim the work.

Why it exists

Long-running systems cross process boundaries, wait on external actors, and repeat work after uncertainty. Lease gives engineers a precise way to reason about one part of that reliability problem.

The naive implementation

run task
  → keep progress in memory
  → assume the call succeeded
  → continue

What breaks

The process can disappear between an external effect and the local record of that effect. On recovery, the system no longer knows what happened. Retrying blindly may duplicate work; skipping may lose it.

How it works

Worker A claims Run 91
        ↓
lease expires at 10:01
        ↓
Worker A dies
        ↓
10:01   Worker B may claim Run 91

What it does not guarantee

This concept is not a complete reliability strategy. It does not make external side effects transactional, prove semantic correctness, or remove the need for monitoring and evaluation.

Related concepts

Use it in a pattern