From 8637f8a85276e4a5862f9345946d5e9bfbca4c38 Mon Sep 17 00:00:00 2001 From: Michael H Date: Sat, 29 Jun 2019 10:30:09 -0400 Subject: [PATCH] [Filter] Fix cache invalidation (#2810) --- redbot/cogs/filter/filter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/redbot/cogs/filter/filter.py b/redbot/cogs/filter/filter.py index fae8cab8e..e81494234 100644 --- a/redbot/cogs/filter/filter.py +++ b/redbot/cogs/filter/filter.py @@ -286,6 +286,10 @@ class Filter(commands.Cog): def invalidate_cache(self, guild: discord.Guild, channel: discord.TextChannel = None): """ Invalidate a cached pattern""" self.pattern_cache.pop((guild, channel), None) + if channel is None: + for keyset in list(self.pattern_cache.keys()): # cast needed, no remove + if guild in keyset: + self.pattern_cache.pop(keyset, None) async def add_to_filter( self, server_or_channel: Union[discord.Guild, discord.TextChannel], words: list