diff --git a/projects/fal_client/src/fal_client/client.py b/projects/fal_client/src/fal_client/client.py index c70f93e0..b8921cee 100644 --- a/projects/fal_client/src/fal_client/client.py +++ b/projects/fal_client/src/fal_client/client.py @@ -88,7 +88,7 @@ def __init__(self, key: str) -> None: base_upload_url="", expires_at=datetime.min.replace(tzinfo=timezone.utc), ) - self._lock: threading.Lock = threading.Lock() + self._lock: asyncio.Lock = asyncio.Lock() self._url = f"{REST_URL}/storage/auth/token?storage_type=fal-cdn-v3" self._headers = { "Authorization": f"Key {self._key}", @@ -110,7 +110,7 @@ async def _refresh_token(self) -> None: ) async def get_token(self) -> CDNToken: - with self._lock: + async with self._lock: if self._token.is_expired(): self._token = await self._refresh_token() return self._token