Skip to content

Commit

Permalink
Use an async decorator for ttl cache in iam provider
Browse files Browse the repository at this point in the history
The cached decorator from cachetools can't be used on
an async method as the cache returns an awaited
coroutine which can't be awaited again.
  • Loading branch information
alisaifee committed Dec 6, 2024
1 parent 596b7cc commit 010eca6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion coredis/recipes/credentials/iam_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
# as coredis[recipes]
import aiobotocore.session
from aiobotocore.signers import AioRequestSigner
from asyncache import cached
from botocore.model import ServiceId
from cachetools import TTLCache, cached
from cachetools import TTLCache

from coredis.credentials import AbstractCredentialProvider, UserPass

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ warn_unused_ignores = true
module = [
"async_timeout",
"beartype",
"asyncache",
"aiobotocore.*",
"botocore.*",
"cachetools",
Expand Down
4 changes: 2 additions & 2 deletions requirements/recipes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
aiobotocore
cachetools
aiobotocore>=2.15.2
asyncache>=0.3.1

0 comments on commit 010eca6

Please sign in to comment.