From 2be3a0284fc06bf9a5840dc23112277b4e19ab85 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Mon, 22 Feb 2021 18:27:24 +0000 Subject: [PATCH] Use ms for expiry time on get() --- synapse/replication/tcp/external_cache.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/synapse/replication/tcp/external_cache.py b/synapse/replication/tcp/external_cache.py index 8c1ccd9db2..fcb7122454 100644 --- a/synapse/replication/tcp/external_cache.py +++ b/synapse/replication/tcp/external_cache.py @@ -101,7 +101,7 @@ class ExternalCache: ) ) - async def get(self, cache_name: str, key: str, expiry_s: Optional[int] = None) -> Optional[Any]: + async def get(self, cache_name: str, key: str, expiry_ms: Optional[int] = None) -> Optional[Any]: """Look up a key/value in the named cache.""" if self._redis_connection is None: @@ -120,11 +120,11 @@ class ExternalCache: if not result: return None - if expiry_s: + if expiry_ms: # If we are using this key, bump the expiry time # NOTE: txredisapi does not support pexire, so we must use (expire) seconds await make_deferred_yieldable( - self._redis_connection.expire(cache_key, expiry_s) + self._redis_connection.expire(cache_key, expiry_ms // 1000) )