From e297fb26a5f476050729a93f32d871e46ea1316d Mon Sep 17 00:00:00 2001 From: MarkKoz Date: Sun, 3 Jan 2021 20:47:37 -0800 Subject: HelpChannels: fix race condition when unclaiming a channel Place a channel-specific lock on `unclaim_channel`. If both the dormant task and the command simultaneously unclaim a channel, one of them will silently be aborted. Fix #1341 --- bot/exts/help_channels/_cog.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py index bea5fd9c0..f866e98af 100644 --- a/bot/exts/help_channels/_cog.py +++ b/bot/exts/help_channels/_cog.py @@ -351,6 +351,7 @@ class HelpChannels(commands.Cog): _stats.report_counts() + @lock.lock_arg(f"{NAMESPACE}.unclaim", "channel") async def unclaim_channel(self, channel: discord.TextChannel, *, is_auto: bool = True) -> None: """ Unclaim an in-use help `channel` to make it dormant. -- cgit v1.2.3