Repository navigation
Install with pip install -U async-limiter (PyPI).
Fixed
- Calling
release()more often thanacquire()raised the concurrent limit
for the rest of the limiter's life. The extra release is now ignored and
logged as a warning. - Setting the system clock back kept callers waiting until the old timestamps
expired. The limiter now measures time with a monotonic clock. - A limiter used from a second event loop, such as a module-level limiter and
twoasyncio.run()calls or a test suite with one loop per test, raised
RuntimeErroras soon as a caller had to wait. This also affected
module-level limiters on Python 3.9. - On Python 3.9, creating a limiter after an earlier
asyncio.run()had
finished raisedRuntimeError.
Added
wait_marginargument: the extra time a waiting caller sleeps past the moment
a slot opens. It defaults to 0.1 seconds, the value that was hardcoded before;
wait_margin=0gives the full allowed throughput.py.typedmarker, so type checkers use the package's annotations.- Python 3.12 and 3.13 are tested and declared as supported.
devextra with the tools CI runs.
Changed
- An unexpected error inside
acquire()is no longer re-raised as
RuntimeError; the original exception propagates. No such error is known to
occur, and theerrorsmetric stays inget_metrics()with a value of 0. - The limiter no longer logs a warning when a waiting caller is cancelled, or a
debug line each time old requests leave the window. - Using one limiter from two event loops that run at the same time (two
threads) raisesRuntimeErroronacquire(). - The
testextra no longer installsaiohttp, which only the example uses. - The package is classified as Beta, not Production/Stable.
request_timesholdstime.monotonic()values, nottime.time()values.
Full changelog: v1.1.0...v1.2.0