mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Move room mutex in federation API (#1830)
* Move room mutex in federation API to surround resolveStatesAndCheck * Guard processEventWithMissingState instead * Revert "Guard processEventWithMissingState instead" This reverts commit 0ce88036aa79b0ce97e967afb70fe932a547d5f0.
This commit is contained in:
parent
e08942fb00
commit
080ae6a829
1 changed files with 2 additions and 2 deletions
|
@ -498,8 +498,6 @@ func (t *txnReq) getServers(ctx context.Context, roomID string) []gomatrixserver
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *txnReq) processEvent(ctx context.Context, e *gomatrixserverlib.Event) error {
|
func (t *txnReq) processEvent(ctx context.Context, e *gomatrixserverlib.Event) error {
|
||||||
t.roomsMu.Lock(e.RoomID())
|
|
||||||
defer t.roomsMu.Unlock(e.RoomID())
|
|
||||||
logger := util.GetLogger(ctx).WithField("event_id", e.EventID()).WithField("room_id", e.RoomID())
|
logger := util.GetLogger(ctx).WithField("event_id", e.EventID()).WithField("room_id", e.RoomID())
|
||||||
t.work = "" // reset from previous event
|
t.work = "" // reset from previous event
|
||||||
|
|
||||||
|
@ -718,7 +716,9 @@ func (t *txnReq) processEventWithMissingState(
|
||||||
respStates[i] = states[i].RespState
|
respStates[i] = states[i].RespState
|
||||||
}
|
}
|
||||||
// There's more than one previous state - run them all through state res
|
// There's more than one previous state - run them all through state res
|
||||||
|
t.roomsMu.Lock(e.RoomID())
|
||||||
resolvedState, err = t.resolveStatesAndCheck(gmectx, roomVersion, respStates, backwardsExtremity)
|
resolvedState, err = t.resolveStatesAndCheck(gmectx, roomVersion, respStates, backwardsExtremity)
|
||||||
|
t.roomsMu.Unlock(e.RoomID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.GetLogger(ctx).WithError(err).Errorf("Failed to resolve state conflicts for event %s", backwardsExtremity.EventID())
|
util.GetLogger(ctx).WithError(err).Errorf("Failed to resolve state conflicts for event %s", backwardsExtremity.EventID())
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue