WIP test to avoid roomserver deadlocks

This commit is contained in:
Kegan Dougal 2021-03-09 11:11:29 +00:00
parent 3c419be6af
commit ed5dc8646d
12 changed files with 25 additions and 18 deletions

View file

@ -56,7 +56,7 @@ func CheckForSoftFail(
// Then get the state entries for the current state snapshot.
// We'll use this to check if the event is allowed right now.
roomState := state.NewStateResolution(db, *roomInfo)
roomState := state.NewStateResolution(db, *roomInfo, nil)
authStateEntries, err = roomState.LoadStateAtSnapshot(ctx, roomInfo.StateSnapshotNID)
if err != nil {
return true, fmt.Errorf("roomState.LoadStateAtSnapshot: %w", err)

View file

@ -172,7 +172,7 @@ func GetMembershipsAtState(
}
func StateBeforeEvent(ctx context.Context, db storage.Database, info types.RoomInfo, eventNID types.EventNID) ([]types.StateEntry, error) {
roomState := state.NewStateResolution(db, info)
roomState := state.NewStateResolution(db, info, nil)
// Lookup the event NID
eIDs, err := db.EventIDs(ctx, []types.EventNID{eventNID})
if err != nil {
@ -217,7 +217,7 @@ func LoadStateEvents(
func CheckServerAllowedToSeeEvent(
ctx context.Context, db storage.Database, info types.RoomInfo, eventID string, serverName gomatrixserverlib.ServerName, isServerInRoom bool,
) (bool, error) {
roomState := state.NewStateResolution(db, info)
roomState := state.NewStateResolution(db, info, nil)
stateEntries, err := roomState.LoadStateAtEvent(ctx, eventID)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
@ -379,7 +379,7 @@ func QueryLatestEventsAndState(
return nil
}
roomState := state.NewStateResolution(db, *roomInfo)
roomState := state.NewStateResolution(db, *roomInfo, nil)
response.RoomExists = true
response.RoomVersion = roomInfo.RoomVersion