Skip to content

Add lease_wait_fn to customize lease retry waits#89

Open
xmartinez wants to merge 1 commit into
mainfrom
xavi/lease-wait-fn
Open

Add lease_wait_fn to customize lease retry waits#89
xmartinez wants to merge 1 commit into
mainfrom
xavi/lease-wait-fn

Conversation

@xmartinez

Copy link
Copy Markdown

Adds an optional lease_wait_fn: Callable[[float], None] parameter to
get_or_lease() and get_or_lease_cas(). When provided, it is invoked
in place of time.sleep between lease retries.

The custom wait function can be used in tests (e.g., to mock time), to
integrate with greenlet-based frameworks (such as gevent) or to
limit wait concurrency.

Adds an optional `lease_wait_fn: Callable[[float], None]` parameter to
`get_or_lease()` and `get_or_lease_cas()`. When provided, it is invoked
in place of `time.sleep` between lease retries.

The custom wait function can be used in tests (e.g., to mock time), to
integrate with `greenlet`-based frameworks (such as `gevent`) or to
limit wait concurrency.
@xmartinez xmartinez force-pushed the xavi/lease-wait-fn branch from 8bc0d09 to 3f2e1c8 Compare May 26, 2026 08:13
@xmartinez xmartinez requested a review from bisho May 26, 2026 08:14
@xmartinez xmartinez marked this pull request as ready for review May 26, 2026 08:14
@xmartinez xmartinez requested a review from a team May 29, 2026 10:07

@bisho bisho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants