Copy recent messages before cleaning them

This commit is contained in:
Yohann D'ANELLO 2021-01-09 21:07:08 +01:00
parent dbf3953ad4
commit e3adc73d01
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 1 additions and 1 deletions

View File

@ -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()