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

@ -249,7 +249,7 @@ func (r *Inputer) calculateAndSetState(
isRejected bool,
) error {
var err error
roomState := state.NewStateResolution(r.DB, roomInfo)
roomState := state.NewStateResolution(r.DB, roomInfo, nil)
if input.HasState && !isRejected {
// Check here if we think we're in the room already.
@ -271,7 +271,7 @@ func (r *Inputer) calculateAndSetState(
}
entries = types.DeduplicateStateEntries(entries)
if stateAtEvent.BeforeStateSnapshotNID, err = r.DB.AddState(ctx, roomInfo.RoomNID, nil, entries); err != nil {
if stateAtEvent.BeforeStateSnapshotNID, err = r.DB.AddState(ctx, nil, roomInfo.RoomNID, nil, entries); err != nil {
return fmt.Errorf("r.DB.AddState: %w", err)
}
} else {

View file

@ -199,7 +199,7 @@ func (u *latestEventsUpdater) doUpdateLatestEvents() error {
func (u *latestEventsUpdater) latestState() error {
var err error
roomState := state.NewStateResolution(u.api.DB, *u.roomInfo)
roomState := state.NewStateResolution(u.api.DB, *u.roomInfo, u.updater.Txn)
// Work out if the state at the extremities has actually changed
// or not. If they haven't then we won't bother doing all of the