pyrate_limiter.clocks module¶
Clock implementation using different backend
- class pyrate_limiter.clocks.AbstractClock¶
Bases:
ABCClock that return timestamp for now
- abstractmethod now()¶
Get time as of now, in milliseconds
- Return type:
Union[int,Awaitable[int]]
- class pyrate_limiter.clocks.MonotonicAsyncClock¶
Bases:
AbstractClockMonotonic Async Clock, meant for testing only
- async now()¶
Get monotonic time in milliseconds
- Return type:
int
- class pyrate_limiter.clocks.MonotonicClock¶
Bases:
AbstractClock- now()¶
Get monotonic time in milliseconds
- Return type:
int
- class pyrate_limiter.clocks.PostgresClock(pool)¶
Bases:
AbstractClockGet timestamp using Postgres as remote clock backend
- now()¶
Get current time in milliseconds using Postgres.
Falls back to local time if the DB query fails for any reason.
- Return type:
int