A Temporal Validated Pattern for implementing a durable distributed lock without relying on external databases, caches, or central rate-limiter services. Each lock permit is represented as a short-lived child Workflow whose ID encodes the resource and slot — since Temporal prevents duplicate running Workflow IDs, acquiring a permit becomes an atomic operation. Orphan lock recovery is handled via lease timeouts rather than manual cleanup, eliminating common failure modes like lock state drift or orphaned locks from crashed holders.

1m read timeFrom temporal.io
Post cover image
41 Impressions