Преглед изворни кода

Lock latest event backfill lock when handling Matrix messages

Tulir Asokan пре 2 година
родитељ
комит
5e28343350
1 измењених фајлова са 2 додато и 0 уклоњено
  1. 2 0
      portal.go

+ 2 - 0
portal.go

@@ -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),