aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2021-08-27 17:31:54 +0300
committerGravatar mbaruh <[email protected]>2021-08-27 17:31:54 +0300
commit841a148f45bfe265815eac1aa9f22d84e332f548 (patch)
tree5741ade265259722169532072c26fabb49433aa6
parentMove clean logging to a helper function (diff)
Move setting cleaning flag to correct line
Between the concurrency check and setting the cleaning flag to True there was an await statement, which could potentially cause race conditions.The setting of the flag was moved to right below the concurrency check.
-rw-r--r--bot/exts/moderation/clean.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/bot/exts/moderation/clean.py b/bot/exts/moderation/clean.py
index e198dde9c..2e3f9ac77 100644
--- a/bot/exts/moderation/clean.py
+++ b/bot/exts/moderation/clean.py
@@ -187,6 +187,7 @@ class Clean(Cog):
# Are we already performing a clean?
if self.cleaning:
raise MaxConcurrencyReached("Please wait for the currently ongoing clean operation to complete.")
+ self.cleaning = True
# Set up the correct predicate
if bots_only:
@@ -214,8 +215,6 @@ class Clean(Cog):
# Invocation message has already been deleted
log.info("Tried to delete invocation message, but it was already deleted.")
- self.cleaning = True
-
if use_cache:
message_mappings, message_ids = self._get_messages_from_cache(amount=amount, to_delete=predicate)
else: