diff options
| author | 2021-01-04 17:10:59 -0800 | |
|---|---|---|
| committer | 2021-01-04 23:20:02 -0800 | |
| commit | 8d50a090baa1f2b64c9ba4e9f1830c5b2a2b80a0 (patch) | |
| tree | 004694307070c486afe6cce6f9f4068b5555d191 | |
| parent | HelpChannels: fix race condition when unclaiming a channel (diff) | |
HelpChannels: fix manual use of lock decorator
| -rw-r--r-- | bot/exts/help_channels/_cog.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py index f866e98af..3bdd896f2 100644 --- a/bot/exts/help_channels/_cog.py +++ b/bot/exts/help_channels/_cog.py @@ -363,15 +363,15 @@ class HelpChannels(commands.Cog): Set `is_auto` to True if the channel was automatically closed or False if manually closed. """ claimant_id = await _caches.claimants.get(channel.id) - coroutine = self._unclaim_channel(channel, claimant_id, is_auto) + _unclaim_channel = self._unclaim_channel # It could be possible that there is no claimant cached. In such case, it'd be useless and # possibly incorrect to lock on None. Therefore, the lock is applied conditionally. if claimant_id is not None: decorator = lock.lock_arg(f"{NAMESPACE}.unclaim", "claimant_id", wait=True) - coroutine = decorator(coroutine) + _unclaim_channel = decorator(_unclaim_channel) - return await coroutine + return await _unclaim_channel(channel, claimant_id, is_auto) async def _unclaim_channel(self, channel: discord.TextChannel, claimant_id: int, is_auto: bool) -> None: """Actual implementation of `unclaim_channel`. See that for full documentation.""" |