Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# pyrate_limiter.clocks module

Clock implementation using different backend

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`

class pyrate_limiter.clocks.SQLiteClock(conn)

  Bases: `AbstractClock`

  Get timestamp using SQLite as remote clock backend

  __init__(conn)

    In multiprocessing cases, use the bucket, so that a shared lock is used.

  classmethod default()
  now()

    Get time as of now, in miliseconds

    Return type:

      `int`

  time_query = "SELECT CAST(ROUND((julianday('now') - 2440587.5)*86400000) As INTEGER)"

class pyrate_limiter.clocks.TimeAsyncClock

  Bases: `AbstractClock`

  Time Async Clock, meant for testing only

  async now()

    Get time as of now, in miliseconds

    Return type:

      `int`

class pyrate_limiter.clocks.TimeClock

  Bases: `AbstractClock`

  now()

    Get time as of now, in miliseconds