pyrate_limiter.clocks module

Clock implementation using different backend

class pyrate_limiter.clocks.AbstractClock

Bases: ABC

Clock that return timestamp for now

abstractmethod now()

Get time as of now, in miliseconds

Return type:

int | Awaitable[int]

class pyrate_limiter.clocks.MonotonicAsyncClock

Bases: AbstractClock

Monotonic Async Clock, meant for testing only

async now()

Get time as of now, in miliseconds

Return type:

int

class pyrate_limiter.clocks.MonotonicClock

Bases: AbstractClock

now()

Get time as of now, in miliseconds

class pyrate_limiter.clocks.PostgresClock(pool)

Bases: AbstractClock

Get timestamp using Postgres as remote clock backend

now()

Get time as of now, in miliseconds

Return type:

int