From a09aa4d4fcf0106e843ceb3edc62c6b821077fd4 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Sat, 7 Nov 2020 22:00:20 +0700 Subject: [PATCH 1/2] Set backlog_pending to false on error --- matrix/server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/matrix/server.py b/matrix/server.py index 9fce1c2..d1becdb 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -1618,6 +1618,8 @@ class MatrixServer(object): if isinstance(response, ErrorResponse): self.handle_error_response(response) + room_buffer = self.room_buffers[response.room_id] + room_buffer.backlog_pending = False elif isinstance(response, ToDeviceResponse): try: From 8ee1a77d16b9b0ab13655a39b809314425b4ac53 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Wed, 11 Nov 2020 20:41:17 +0700 Subject: [PATCH 2/2] Only clear backlog_pending flag if the error is an instance of RoomMessagesError --- matrix/server.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/matrix/server.py b/matrix/server.py index d1becdb..d02c827 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -60,6 +60,7 @@ from nio import ( DeleteDevicesResponse, TransportType, RoomMessagesResponse, + RoomMessagesError, EncryptionError, GroupEncryptionError, OlmTrustError, @@ -1618,8 +1619,9 @@ class MatrixServer(object): if isinstance(response, ErrorResponse): self.handle_error_response(response) - room_buffer = self.room_buffers[response.room_id] - room_buffer.backlog_pending = False + if isinstance(response, RoomMessagesError): + room_buffer = self.room_buffers[response.room_id] + room_buffer.backlog_pending = False elif isinstance(response, ToDeviceResponse): try: