The Lease Loop Is Not a Chat Completion
A fencing token is not a paragraph. It is a counter that must rise on a clock, die on a deadline, and never ask a model whether the holder still deserves the lock. Free inference has no place in that loop. Teams keep stuffing chat completions into leader election anyway. A node goes quiet. Logs look messy. Someone wires a cheap model to read the noise and vote on who should keep the lease. The…
A lease is a timed exclusive lock, held by the holder that can prove liveness by raising an epoch before its expiry. Downstream storage must reject any write whose epoch is stale. The model of the world is simple, consisting only of holder ID, epoch, and expiry. This tuple is not improved by any temperature setting or model output.
PostgreSQL can manage a fencing token without any extra ceremony. The lease_loop.py module should be kept free of HTTP clients and model SDKs. It simply inserts or updates rows in the worker\_leases table to acquire or renew the lease. The acquire function returns an epoch integer if successful, or None if the lease is held elsewhere.
The renew function updates the epoch and expiry if the lease is still valid. The hold function continuously acquires and renews the lease in a loop. Writer functions must pass the epoch with every mutating call to ensure they are working with the most up-to-date lease. The lease protection is only as strong as the storage layer, which must verify the fence before accepting any writes.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.