Avoid duplicate del in Conversation._on_read

This commit is contained in:
Lonami Exo 2021-01-14 23:05:49 +01:00
parent cd51c9e47c
commit 00aa0a4bf1

View File

@ -416,16 +416,11 @@ class Conversation(ChatGetter):
self._last_read = event.max_id
remove_reads = []
for msg_id, pending in list(self._pending_reads.items()):
if msg_id >= self._last_read:
remove_reads.append(msg_id)
pending.set_result(True)
del self._pending_reads[msg_id]
for to_remove in remove_reads:
del self._pending_reads[to_remove]
def _get_message_id(self, message):
if message is not None: # 0 is valid but false-y, check for None
return message if isinstance(message, int) else message.id