From e3adc73d01b65f29870e7cb9e15666fb6cdcac81 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 9 Jan 2021 21:07:08 +0100 Subject: [PATCH] Copy recent messages before cleaning them --- squinnondation/peers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squinnondation/peers.py b/squinnondation/peers.py index 0f69edd..e20701d 100644 --- a/squinnondation/peers.py +++ b/squinnondation/peers.py @@ -669,7 +669,7 @@ class User(Peer): Remove messages which are overdue (older than 2 minutes) from the inundation dictionnary. """ self.data_lock.acquire() - for key in self.recent_messages: + for key in self.recent_messages.copy(): if time.time() - self.recent_messages[key][1] > 120: self.recent_messages.pop(key) self.data_lock.release()