aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2021-03-04 21:42:28 +0100
committerGravatar Numerlor <[email protected]>2021-03-05 01:42:27 +0100
commitbd8323501712ed0fc313c502f3e0bd567c111328 (patch)
treed08ab0cb4ac560ddd47d4010497de694ffa65d62
parentUse deque instead of a list (diff)
Move the seconds of a week timedelta into a constant
-rw-r--r--bot/exts/info/doc/_redis_cache.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/bot/exts/info/doc/_redis_cache.py b/bot/exts/info/doc/_redis_cache.py
index cab51c3f1..7de2f3806 100644
--- a/bot/exts/info/doc/_redis_cache.py
+++ b/bot/exts/info/doc/_redis_cache.py
@@ -7,6 +7,8 @@ from async_rediscache.types.base import RedisObject, namespace_lock
if TYPE_CHECKING:
from ._cog import DocItem
+WEEK_SECONDS = datetime.timedelta(weeks=1).total_seconds()
+
class DocRedisCache(RedisObject):
"""Interface for redis functionality needed by the Doc cog."""
@@ -33,7 +35,7 @@ class DocRedisCache(RedisObject):
await connection.hset(redis_key, item.symbol_id, value)
if needs_expire:
- await connection.expire(redis_key, datetime.timedelta(weeks=1).total_seconds())
+ await connection.expire(redis_key, WEEK_SECONDS)
@namespace_lock
async def get(self, item: DocItem) -> Optional[str]: