Added Steam API rate limiter

This commit is contained in:
GeoffreyCoulaud
2023-06-03 18:49:47 +02:00
parent 216c3f5dae
commit 6f77e0d30d
2 changed files with 5 additions and 2 deletions

View File

@@ -43,9 +43,10 @@ class TokenBucketRateLimiter(AbstractContextManager):
if refill_spacing_seconds is not None:
self.REFILL_SPACING_SECONDS = refill_spacing_seconds
# Create locks
# Create synchro data
self.__n_tokens_lock = Lock()
self.queue_lock = Lock()
self.queue = deque()
# Initialize the number of tokens in the bucket
self.bucket = BoundedSemaphore(self.MAX_TOKENS)