Wait for sync to complete when running sync explicitly

This commit is contained in:
Tulir Asokan
2018-04-28 22:01:29 +03:00
parent 445d997be8
commit 193dcc714b
3 changed files with 10 additions and 7 deletions
+3 -2
View File
@@ -223,12 +223,13 @@ class User(AbstractUser):
return await self._search_remote(query), True
async def sync_dialogs(self):
async def sync_dialogs(self, synchronous_create=False):
creators = []
for entity in await self._get_dialogs(limit=30):
portal = po.Portal.get_by_entity(entity)
self.portals[portal.tgid_full] = portal
creators.append(portal.create_matrix_room(self, entity, invites=[self.mxid]))
creators.append(
portal.create_matrix_room(self, entity, invites=[self.mxid], synchronous=synchronous_create))
self.save()
await asyncio.gather(*creators, loop=self.loop)