fix: race condition in history load

This commit is contained in:
mathieui 2021-06-26 13:37:40 +02:00
parent e159fad565
commit 1456566f10

View file

@ -1025,12 +1025,14 @@ class OneToOneTab(ChatTab):
mam_sync = config.get_by_tabname('mam_sync', self.jid)
if use_log and mam_sync:
limit = config.get_by_tabname('mam_sync_limit', self.jid)
self.mam_filler = MAMFiller(logger, self, limit)
mam_filler = MAMFiller(logger, self, limit)
self.mam_filler = mam_filler
async def fallback_no_mam():
await self.mam_filler.done.wait()
if self.mam_filler.result == 0:
await mam_filler.done.wait()
if mam_filler.result == 0:
self.handle_message(initial)
asyncio.ensure_future(fallback_no_mam())
elif use_log and initial:
self.handle_message(initial, display=False)