betty.concurrent module#
Provide utilities for concurrent programming.
- class betty.concurrent.Ledger#
Bases:
objectLazily create locks by keeping a ledger.
The ledger lock is released once a transaction lock is acquired.
- final class betty.concurrent.RateLimiter#
Bases:
objectRate-limit operations.
This class implements the Token Bucket algorithm.
- async betty.concurrent.backoff() AsyncIterator[int]#
Implement exponential backoff.
The returned iterator sleeps after every iteration, increasing the duration with every iteration, up to a limit.
Usage:
async for iteration in backoff(): if success: return # Or break.