diff options
author | mathieui <mathieui@mathieui.net> | 2021-06-26 13:37:40 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-06-26 13:37:40 +0200 |
commit | 1456566f1037eb07fd004b6d8916aa6e20af1647 (patch) | |
tree | 6ed898d46aaffb128819e5837c76b0fd1a955dfb | |
parent | e159fad5650eddb846266a9bd5b7cdc25d056f74 (diff) | |
download | poezio-1456566f1037eb07fd004b6d8916aa6e20af1647.tar.gz poezio-1456566f1037eb07fd004b6d8916aa6e20af1647.tar.bz2 poezio-1456566f1037eb07fd004b6d8916aa6e20af1647.tar.xz poezio-1456566f1037eb07fd004b6d8916aa6e20af1647.zip |
fix: race condition in history load
-rw-r--r-- | poezio/tabs/basetabs.py | 8 |
1 files 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) |