From fa0d870debe58c949981b2d1140657ebd85b930d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 24 Jan 2019 11:55:31 +0100 Subject: [PATCH] server: Only set the lag from the response if it's less than the current lag. --- matrix/server.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/matrix/server.py b/matrix/server.py index bf1f3e4..abc52d4 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -1267,9 +1267,12 @@ class MatrixServer(object): def handle_response(self, response): # type: (Response) -> None - self.lag = response.elapsed * 1000 - self.lag_done = True - W.bar_item_update("lag") + response_lag = response.elapsed + + if response_lag >= self.client.lag: + self.lag = response_lag * 1000 + self.lag_done = True + W.bar_item_update("lag") if isinstance(response, ErrorResponse): self.handle_error_response(response)