aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2021-01-03 20:47:37 -0800
committerGravatar MarkKoz <[email protected]>2021-01-04 23:20:02 -0800
commite297fb26a5f476050729a93f32d871e46ea1316d (patch)
treef40a1163e36fcb457cc677370fc451ca890f7950
parentHelpChannels: change caller str parameter to a bool (diff)
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
-rw-r--r--bot/exts/help_channels/_cog.py1
1 files changed, 1 insertions, 0 deletions
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.