aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2021-01-10 01:48:26 +0100
committerGravatar Numerlor <[email protected]>2021-01-10 06:16:10 +0100
commit298ad2f8e8f31d9f06a9e01a91a4d08f5b5d6347 (patch)
treedd35f0208c1725d6058f28ce6c405db7ecb03c23
parentHandle equal DocItems in the queue (diff)
Refresh inventories when the redis cache is cleared
Because the futures are cleaned up and Markdown only exists in the cache after a short time, items that were requested previously and had the cache cleared would be missing from the CachedParser
-rw-r--r--bot/exts/info/doc/_cog.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py
index cee482c30..a78916d4a 100644
--- a/bot/exts/info/doc/_cog.py
+++ b/bot/exts/info/doc/_cog.py
@@ -565,9 +565,11 @@ class DocCog(commands.Cog):
@docs_group.command(name="cleardoccache")
@commands.has_any_role(*MODERATION_ROLES)
+ @lock("doc", COMMAND_LOCK_SINGLETON, raise_error=True)
async def clear_cache_command(self, ctx: commands.Context, package_name: PackageName) -> None:
"""Clear the persistent redis cache for `package`."""
if await doc_cache.delete(package_name):
+ await self.refresh_inventory()
await ctx.send(f"Successfully cleared the cache for `{package_name}`.")
else:
await ctx.send("No keys matching the package found.")