You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -209,9 +209,9 @@ When multiple bucket types are needed and items must be routed based on certain
209
209
First, define your clock (time source). Most use cases work with the built-in clocks:
210
210
211
211
```python
212
-
from pyrate_limiter.clock importTimeClock, MonotonicClock, SQLiteClock
212
+
from pyrate_limiter.clock import MonotonicClock, SQLiteClock
213
213
214
-
base_clock =TimeClock()
214
+
base_clock =MonotonicClock()
215
215
```
216
216
217
217
PyrateLimiter does not assume routing logic, so you implement a custom BucketFactory. At a minimum, these two methods must be defined:
@@ -439,7 +439,7 @@ Here's an example that will raise an exception on the 4th request:
439
439
```python
440
440
rate = Rate(3, Duration.SECOND)
441
441
bucket = InMemoryBucket([rate])
442
-
clock =TimeClock()
442
+
clock =MonotonicClock()
443
443
444
444
445
445
classMyBucketFactory(BucketFactory):
@@ -662,7 +662,7 @@ Multiprocessing: If using MultiprocessBucket, two locks are used in Limiter: a t
662
662
Time source can be anything from anywhere: be it python's built-in time, or monotonic clock, sqliteclock, or crawling from world time server(well we don't have that, but you can!).
663
663
664
664
```python
665
-
from pyrate_limiter importTimeClock# use python' time.time()
665
+
from pyrate_limiter importMonotonicClock# use python time.monotonic()
666
666
from pyrate_limiter import MonotonicClock # use python time.monotonic()
0 commit comments