瀏覽代碼

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) {
+	portal.latestEventBackfillLock.Lock()
+	defer portal.latestEventBackfillLock.Unlock()
 	evtTS := time.UnixMilli(msg.evt.Timestamp)
 	timings := messageTimings{
 		initReceive:  msg.evt.Mautrix.ReceivedAt.Sub(evtTS),