server: Change the way syncs are scheduled.

This commit is contained in:
Damir Jelić 2018-07-31 12:03:23 +02:00
parent 0c8e732ad0
commit 7a8ce17d8a

View file

@ -526,15 +526,12 @@ class MatrixServer:
def _handle_sync(self, response):
# we got the same batch again, nothing to do
if self.next_batch == response.next_batch:
self.sync()
self.schedule_sync()
return
self._handle_room_info(response)
# self._queue_joined_info(response)
self.next_batch = response.next_batch
# self.check_one_time_keys(response.one_time_key_count)
# self.handle_events()
self.sync()
self.schedule_sync()
def handle_response(self, response):
# type: (MatrixMessage) -> None
@ -650,6 +647,9 @@ def matrix_timer_cb(server_name, remaining_calls):
# server.disconnect()
# return W.WEECHAT_RC_OK
if server.sync_time and current_time > (server.sync_time + 2):
server.sync()
while server.send_queue:
message = server.send_queue.popleft()
prnt_debug(