Copy recent messages before cleaning them
This commit is contained in:
parent
dbf3953ad4
commit
e3adc73d01
|
@ -669,7 +669,7 @@ class User(Peer):
|
||||||
Remove messages which are overdue (older than 2 minutes) from the inundation dictionnary.
|
Remove messages which are overdue (older than 2 minutes) from the inundation dictionnary.
|
||||||
"""
|
"""
|
||||||
self.data_lock.acquire()
|
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:
|
if time.time() - self.recent_messages[key][1] > 120:
|
||||||
self.recent_messages.pop(key)
|
self.recent_messages.pop(key)
|
||||||
self.data_lock.release()
|
self.data_lock.release()
|
||||||
|
|
Loading…
Reference in New Issue