From 6f1f9c598d0af8d52d1d3558efa99de7e8415ae1 Mon Sep 17 00:00:00 2001 From: Patrick Neff Date: Thu, 6 Aug 2020 19:47:25 +0200 Subject: [PATCH] Fix upload_keys --- matrix_bot/bot.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/matrix_bot/bot.py b/matrix_bot/bot.py index 06b11880..ac36265b 100644 --- a/matrix_bot/bot.py +++ b/matrix_bot/bot.py @@ -129,8 +129,7 @@ class Bot(object): return self.__client async def __upload_keys(self) -> None: - if self.client.should_upload_keys: - await self.client.keys_upload() + await self.client.keys_upload() if self.client.should_query_keys: await self.client.keys_query() @@ -141,9 +140,12 @@ class Bot(object): async def sync(self) -> None: self.logger.debug('Starting sync') + next_batch = self.__read_next_batch() await self.__upload_keys() - await self.client.sync(timeout=30000, full_state=True) + await self.client.sync(timeout=30000, + full_state=True, + since=next_batch) async def sync_forever(self) -> None: # next_batch = self.__read_next_batch() @@ -159,7 +161,7 @@ class Bot(object): self.logger.debug('Adding callbacks') client.add_to_device_callback(self.__to_device_callback, (KeyVerificationEvent, )) - self.__upload_keys() + await self.__upload_keys() click.secho('\nStarting verification process...', bold=True, fg='green')