Skip to main content

prefect_redis.lease_storage

Classes

ConcurrencyLeaseStorage

A Redis-based concurrency lease storage implementation. Methods:

create_lease

list_holders_for_limit

read_active_lease_ids

read_expired_lease_ids

read_lease

renew_lease

Atomically renew a concurrency lease by updating its expiration. Uses a Lua script to atomically check if the lease exists, update its expiration in the lease data, and update the index - all in a single atomic operation, preventing race conditions from creating orphaned index entries. Args:
  • lease_id: The ID of the lease to renew
  • ttl: The new time-to-live duration
Returns:
  • True if the lease was renewed, False if it didn’t exist

revoke_lease