diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2021-04-13 11:13:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-13 11:13:07 +0100 |
commit | 080ae6a8291e2bafb569eb9f163f67f85275d678 (patch) | |
tree | ce6d2917ff71a65277e05bf5b9df4c90a4b0c322 /federationapi/routing/send.go | |
parent | e08942fb00433420af72dc401f44586623d78c41 (diff) |
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.
Diffstat (limited to 'federationapi/routing/send.go')
-rw-r--r-- | federationapi/routing/send.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go index fee6d565..708ba38e 100644 --- a/federationapi/routing/send.go +++ b/federationapi/routing/send.go @@ -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 { - 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()) t.work = "" // reset from previous event @@ -718,7 +716,9 @@ func (t *txnReq) processEventWithMissingState( respStates[i] = states[i].RespState } // 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) + t.roomsMu.Unlock(e.RoomID()) if err != nil { util.GetLogger(ctx).WithError(err).Errorf("Failed to resolve state conflicts for event %s", backwardsExtremity.EventID()) return err |