diff options
| author | Dan Hess <[email protected]> | 2020-12-26 19:58:58 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-26 20:58:58 -0500 |
| commit | faffc8eeb2ca06cae60b726fa873e474a51ac39b (patch) | |
| tree | d8f6885d0e0515737540eecae379a3ab6580ee39 | |
| parent | Change highlight text colour on dark theme (diff) | |
| download | discord.py-faffc8eeb2ca06cae60b726fa873e474a51ac39b.tar.xz discord.py-faffc8eeb2ca06cae60b726fa873e474a51ac39b.zip | |
[commands] Correct concurrency never releasing during prepare call
| -rw-r--r-- | discord/ext/commands/core.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 4f36ab9a..248a0e14 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -781,14 +781,19 @@ class Command(_BaseCommand): if self._max_concurrency is not None: await self._max_concurrency.acquire(ctx) - if self.cooldown_after_parsing: - await self._parse_arguments(ctx) - self._prepare_cooldowns(ctx) - else: - self._prepare_cooldowns(ctx) - await self._parse_arguments(ctx) + try: + if self.cooldown_after_parsing: + await self._parse_arguments(ctx) + self._prepare_cooldowns(ctx) + else: + self._prepare_cooldowns(ctx) + await self._parse_arguments(ctx) - await self.call_before_hooks(ctx) + await self.call_before_hooks(ctx) + except: + if self._max_concurrency is not None: + await self._max_concurrency.release(ctx) + raise def is_on_cooldown(self, ctx): """Checks whether the command is currently on cooldown. |