From 1456566f1037eb07fd004b6d8916aa6e20af1647 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 26 Jun 2021 13:37:40 +0200 Subject: fix: race condition in history load --- poezio/tabs/basetabs.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index f52122a5..0991c657 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -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) -- cgit v1.2.3