server: Handle case where we receive a sent message first in a sync.

This commit is contained in:
Damir Jelić 2019-01-21 00:27:04 +01:00
parent f57b1b32c0
commit a34d1e68b0

View file

@ -953,7 +953,14 @@ class MatrixServer(object):
room_buffer.last_read_event = response.event_id
room_buffer = self.room_buffers[response.room_id]
message = room_buffer.sent_messages_queue.pop(response.uuid)
message = room_buffer.sent_messages_queue.pop(response.uuid, None)
# The message might have been returned in a sync response before we got
# a room send response.
if not message:
return
message.event_id = response.event_id
# We already printed the message, just modify it to contain the proper
# colors and formatting.