Lock latest event backfill lock when handling Matrix messages

This commit is contained in:
Tulir Asokan 2023-03-02 14:14:49 +02:00
parent 65e0c0019e
commit 5e28343350

View file

@ -313,6 +313,8 @@ func (portal *Portal) handleMessageLoopItem(msg PortalMessage) {
} }
func (portal *Portal) handleMatrixMessageLoopItem(msg PortalMatrixMessage) { func (portal *Portal) handleMatrixMessageLoopItem(msg PortalMatrixMessage) {
portal.latestEventBackfillLock.Lock()
defer portal.latestEventBackfillLock.Unlock()
evtTS := time.UnixMilli(msg.evt.Timestamp) evtTS := time.UnixMilli(msg.evt.Timestamp)
timings := messageTimings{ timings := messageTimings{
initReceive: msg.evt.Mautrix.ReceivedAt.Sub(evtTS), initReceive: msg.evt.Mautrix.ReceivedAt.Sub(evtTS),