diff options
| author | 2020-11-29 04:12:04 +0100 | |
|---|---|---|
| committer | 2020-11-29 04:45:36 +0100 | |
| commit | 0d3d2bd632e2ed2e14eaacb7db9b49de4cd4baa5 (patch) | |
| tree | 5cd640168da467c48de176e2e5776c0a7ec2d149 | |
| parent | Ensure packages from PRIORITY_PACKAGES are directly accessible (diff) | |
Use timedelta instead of constructing duration manually
A newline was also added to set to keep it consistent with
set_if_exists
| -rw-r--r-- | bot/exts/info/doc/_redis_cache.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bot/exts/info/doc/_redis_cache.py b/bot/exts/info/doc/_redis_cache.py index 2230884c9..e8577aa64 100644 --- a/bot/exts/info/doc/_redis_cache.py +++ b/bot/exts/info/doc/_redis_cache.py @@ -19,7 +19,8 @@ class DocRedisCache(RedisObject): Keys expire after a week to keep data up to date. """ - expiry_timestamp = datetime.datetime.now().timestamp() + 7 * 24 * 60 * 60 + expiry_timestamp = (datetime.datetime.now() + datetime.timedelta(weeks=1)).timestamp() + with await self._get_pool_connection() as connection: await connection.hset( f"{self.namespace}:{item.package}", @@ -34,7 +35,7 @@ class DocRedisCache(RedisObject): Keys expire after a week to keep data up to date. """ - expiry_timestamp = datetime.datetime.now().timestamp() + 7 * 24 * 60 * 60 + expiry_timestamp = (datetime.datetime.now() + datetime.timedelta(weeks=1)).timestamp() with await self._get_pool_connection() as connection: if await connection.hexists(f"{self.namespace}:{item.package}", self.get_item_key(item)): |