diff --git a/relay/http_signatures.py b/relay/http_signatures.py index 0965cfc..81dea8d 100644 --- a/relay/http_signatures.py +++ b/relay/http_signatures.py @@ -7,6 +7,8 @@ from Crypto.PublicKey import RSA from Crypto.Hash import SHA, SHA256, SHA512 from Crypto.Signature import PKCS1_v1_5 +from async_lru import alru_cache + from .remote_actor import fetch_actor @@ -57,6 +59,7 @@ def sign_headers(headers, key, key_id): return ','.join(chunks) +@alru_cache(maxsize=16384) async def fetch_actor_key(actor): actor_data = await fetch_actor(actor) diff --git a/requirements.txt b/requirements.txt index ea34d02..748c6e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ PyYAML==3.13 simplejson==3.16.0 yarl==1.2.6 cachetools +async_lru