diff --git a/backfillqueue.go b/backfillqueue.go index 798efea..b689883 100644 --- a/backfillqueue.go +++ b/backfillqueue.go @@ -310,12 +310,13 @@ func (user *User) getRoomsForBackfillAndEnqueue(ctx context.Context) { // Create all of the portals locally and enqueue backfill requests for // all of them. - portals := []*Portal{} txn, err := user.bridge.DB.Begin() { + portals := []*Portal{} var i int - for guid, roomInfo := range roomInfoResp.Rooms { - portal := user.bridge.GetPortalByGUIDWithTransaction(txn, guid) + for _, chatIdentifier := range chats { + roomInfo := roomInfoResp.Rooms[chatIdentifier.ChatGUID] + portal := user.bridge.GetPortalByGUIDWithTransaction(txn, chatIdentifier.ChatGUID) portal.MXID = roomInfo.RoomID portal.Update(txn) portals = append(portals, portal)