From dc47c850ceee67696b261cfac05a17a4908b79ce Mon Sep 17 00:00:00 2001 From: GeoffreyCoulaud Date: Sat, 3 Jun 2023 17:33:51 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Moved=20Steam=20rate=20limiter?= =?UTF-8?q?=20init=20to=20runtime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/steam.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/steam.py b/src/utils/steam.py index cdef804..58d8ee1 100644 --- a/src/utils/steam.py +++ b/src/utils/steam.py @@ -71,9 +71,13 @@ class SteamHelper: """Helper around the Steam API""" base_url = "https://store.steampowered.com/api" + rate_limiter: SteamRateLimiter = None - # Shared across instances - rate_limiter: SteamRateLimiter = SteamRateLimiter() + def __init__(self) -> None: + # Instanciate the rate limiter on the class to share across instances + # Can't be done at class creation time, schema isn't available yet + if self.__class__.rate_limiter is None: + self.__class__.rate_limiter = SteamRateLimiter() def get_manifest_data(self, manifest_path) -> SteamManifestData: """Get local data for a game from its manifest"""