From 5e2834335008189466bdd1a320b66b96e6448393 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 2 Mar 2023 14:14:49 +0200 Subject: [PATCH] Lock latest event backfill lock when handling Matrix messages --- portal.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/portal.go b/portal.go index 926647d..59613d4 100644 --- a/portal.go +++ b/portal.go @@ -313,6 +313,8 @@ func (portal *Portal) handleMessageLoopItem(msg PortalMessage) { } func (portal *Portal) handleMatrixMessageLoopItem(msg PortalMatrixMessage) { + portal.latestEventBackfillLock.Lock() + defer portal.latestEventBackfillLock.Unlock() evtTS := time.UnixMilli(msg.evt.Timestamp) timings := messageTimings{ initReceive: msg.evt.Mautrix.ReceivedAt.Sub(evtTS),