pyrate_limiter.abstracts.wrappers module#
Wrappers over different abstract types
- class pyrate_limiter.abstracts.wrappers.BucketAsyncWrapper(bucket)#
Bases:
pyrate_limiter.abstracts.bucket.AbstractBucket
BucketAsyncWrapper is a wrapping over any bucket that turns a async/synchronous bucket into an async one
- async count()#
Count number of items in the bucket
- property failing_rate#
- async leak(current_timestamp=None)#
leaking bucket - removing items that are outdated
- Return type
- async peek(index)#
Peek at the rate-item at a specific index in latest-to-earliest order NOTE: The reason we cannot peek from the start of the queue(earliest-to-latest) is we can’t really tell how many outdated items are still in the queue
- async put(item)#
Put an item (typically the current time) in the bucket return true if successful, otherwise false
- property rates#