Merge branch 'main' of github.com:matrix-org/dendrite into s7evink/device-list-updater-again

This commit is contained in:
Till Faelligen 2023-11-08 14:22:28 +01:00
commit 51770e2366
No known key found for this signature in database
GPG key ID: ACCDC9606D472758
2 changed files with 14 additions and 1 deletions

View file

@ -17,6 +17,7 @@ package query
import (
"context"
"encoding/json"
"errors"
"fmt"
"sort"
@ -56,6 +57,12 @@ func (querier *Queryer) QueryNextRoomHierarchyPage(ctx context.Context, walker r
break
}
// If the context is canceled, we might still have discovered rooms
// return them to the client and let the client know there _may_ be more rooms.
if errors.Is(ctx.Err(), context.Canceled) {
break
}
// pop the stack
queuedRoom := unvisited[len(unvisited)-1]
unvisited = unvisited[:len(unvisited)-1]
@ -112,6 +119,11 @@ func (querier *Queryer) QueryNextRoomHierarchyPage(ctx context.Context, walker r
pubRoom := publicRoomsChunk(ctx, querier, queuedRoom.RoomID)
if pubRoom == nil {
util.GetLogger(ctx).WithField("room_id", queuedRoom.RoomID).Debug("unable to get publicRoomsChunk")
continue
}
discoveredRooms = append(discoveredRooms, fclient.RoomHierarchyRoom{
PublicRoom: *pubRoom,
RoomType: roomType,

View file

@ -44,7 +44,7 @@ func GetEvent(
rsAPI api.SyncRoomserverAPI,
) util.JSONResponse {
ctx := req.Context()
db, err := syncDB.NewDatabaseTransaction(ctx)
db, err := syncDB.NewDatabaseSnapshot(ctx)
logger := util.GetLogger(ctx).WithFields(logrus.Fields{
"event_id": eventID,
"room_id": rawRoomID,
@ -56,6 +56,7 @@ func GetEvent(
JSON: spec.InternalServerError{},
}
}
defer db.Rollback() // nolint: errcheck
roomID, err := spec.NewRoomID(rawRoomID)
if err != nil {