From 715a5985130ef774e74ff8464bd4211ac9107416 Mon Sep 17 00:00:00 2001 From: Klemek Date: Fri, 9 Apr 2021 19:11:30 +0200 Subject: [PATCH] fix cancelled bug --- src/logs/guild_logs.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/logs/guild_logs.py b/src/logs/guild_logs.py index 6ba20cf..3e5f748 100644 --- a/src/logs/guild_logs.py +++ b/src/logs/guild_logs.py @@ -89,21 +89,22 @@ class GuildLogs: return self.locked and self.log_file not in current_analysis def lock(self) -> bool: - self.locked = True current_analysis_lock.acquire() if self.log_file in current_analysis: current_analysis_lock.release() return False + self.locked = True current_analysis.append(self.log_file) current_analysis_lock.release() return True def unlock(self): - self.locked = False - current_analysis_lock.acquire() - if self.log_file in current_analysis: - current_analysis.remove(self.log_file) - current_analysis_lock.release() + if self.locked: + self.locked = False + current_analysis_lock.acquire() + if self.log_file in current_analysis: + current_analysis.remove(self.log_file) + current_analysis_lock.release() async def load( self,