|
@@ -132,17 +132,16 @@ func (user *User) backfillInChunks(req *database.Backfill, conv *database.Histor
|
|
portal.backfillLock.Lock()
|
|
portal.backfillLock.Lock()
|
|
defer portal.backfillLock.Unlock()
|
|
defer portal.backfillLock.Unlock()
|
|
|
|
|
|
|
|
+ if !user.shouldCreatePortalForHistorySync(conv, portal) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
backfillState := user.bridge.DB.Backfill.GetBackfillState(user.MXID, &portal.Key)
|
|
backfillState := user.bridge.DB.Backfill.GetBackfillState(user.MXID, &portal.Key)
|
|
if backfillState == nil {
|
|
if backfillState == nil {
|
|
backfillState = user.bridge.DB.Backfill.NewBackfillState(user.MXID, &portal.Key)
|
|
backfillState = user.bridge.DB.Backfill.NewBackfillState(user.MXID, &portal.Key)
|
|
}
|
|
}
|
|
backfillState.SetProcessingBatch(true)
|
|
backfillState.SetProcessingBatch(true)
|
|
defer backfillState.SetProcessingBatch(false)
|
|
defer backfillState.SetProcessingBatch(false)
|
|
- portal.updateBackfillStatus(backfillState)
|
|
|
|
-
|
|
|
|
- if !user.shouldCreatePortalForHistorySync(conv, portal) {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
|
|
var forwardPrevID id.EventID
|
|
var forwardPrevID id.EventID
|
|
var timeEnd *time.Time
|
|
var timeEnd *time.Time
|
|
@@ -194,6 +193,9 @@ func (user *User) backfillInChunks(req *database.Backfill, conv *database.Histor
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Update the backfill status here after the room has been created.
|
|
|
|
+ portal.updateBackfillStatus(backfillState)
|
|
|
|
+
|
|
if sendDisappearedNotice {
|
|
if sendDisappearedNotice {
|
|
user.log.Debugfln("Sending notice to %s that there are disappeared messages ending at %v", portal.Key.JID, conv.LastMessageTimestamp)
|
|
user.log.Debugfln("Sending notice to %s that there are disappeared messages ending at %v", portal.Key.JID, conv.LastMessageTimestamp)
|
|
resp, err := portal.sendMessage(portal.MainIntent(), event.EventMessage, &event.MessageEventContent{
|
|
resp, err := portal.sendMessage(portal.MainIntent(), event.EventMessage, &event.MessageEventContent{
|
|
@@ -735,7 +737,7 @@ func (portal *Portal) updateBackfillStatus(backfillState *database.BackfillState
|
|
"first_timestamp": backfillState.FirstExpectedTimestamp,
|
|
"first_timestamp": backfillState.FirstExpectedTimestamp,
|
|
})
|
|
})
|
|
if err != nil {
|
|
if err != nil {
|
|
- portal.log.Errorln("Error sending backfill status dummy event:", err)
|
|
|
|
|
|
+ portal.log.Errorln("Error sending backfill status event:", err)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|