aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-07-23 22:53:52 +0100
committerGravatar Chris Lovering <[email protected]>2022-08-14 19:43:52 +0100
commitf0d045e685525acca13f52e65d22a6140ffbfc05 (patch)
treeb47e790481053a0f0848c866e641d30bd26988e8
parentNo longer use the removed RedisSession connection object (diff)
Remove usages of the removed namespace_lock decorator
-rw-r--r--bot/exts/info/doc/_redis_cache.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/bot/exts/info/doc/_redis_cache.py b/bot/exts/info/doc/_redis_cache.py
index 0f4d663d1..9ac8492e9 100644
--- a/bot/exts/info/doc/_redis_cache.py
+++ b/bot/exts/info/doc/_redis_cache.py
@@ -5,7 +5,7 @@ import fnmatch
import time
from typing import Optional, TYPE_CHECKING
-from async_rediscache.types.base import RedisObject, namespace_lock
+from async_rediscache.types.base import RedisObject
from bot.log import get_logger
@@ -24,7 +24,6 @@ class DocRedisCache(RedisObject):
super().__init__(*args, **kwargs)
self._set_expires = dict[str, float]()
- @namespace_lock
async def set(self, item: DocItem, value: str) -> None:
"""
Set the Markdown `value` for the symbol `item`.
@@ -59,12 +58,10 @@ class DocRedisCache(RedisObject):
await self.redis_session.client.expire(redis_key, WEEK_SECONDS)
log.info(f"Set {redis_key} to expire in a week.")
- @namespace_lock
async def get(self, item: DocItem) -> Optional[str]:
"""Return the Markdown content of the symbol `item` if it exists."""
return await self.redis_session.client.hget(f"{self.namespace}:{item_key(item)}", item.symbol_id)
- @namespace_lock
async def delete(self, package: str) -> bool:
"""Remove all values for `package`; return True if at least one key was deleted, False otherwise."""
pattern = f"{self.namespace}:{package}:*"
@@ -85,7 +82,6 @@ class DocRedisCache(RedisObject):
class StaleItemCounter(RedisObject):
"""Manage increment counters for stale `DocItem`s."""
- @namespace_lock
async def increment_for(self, item: DocItem) -> int:
"""
Increment the counter for `item` by 1, set it to expire in 3 weeks and return the new value.
@@ -96,7 +92,6 @@ class StaleItemCounter(RedisObject):
await self.redis_session.client.expire(key, WEEK_SECONDS * 3)
return int(await self.redis_session.client.incr(key))
- @namespace_lock
async def delete(self, package: str) -> bool:
"""Remove all values for `package`; return True if at least one key was deleted, False otherwise."""
package_keys = [