mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Move mutex
This commit is contained in:
parent
7779960c9d
commit
89c16d132b
1 changed files with 5 additions and 5 deletions
|
@ -497,7 +497,12 @@ func (t *txnReq) getServers(ctx context.Context, roomID string) []gomatrixserver
|
|||
return t.servers
|
||||
}
|
||||
|
||||
var processEventMutexes = internal.NewMutexByRoom()
|
||||
|
||||
func (t *txnReq) processEvent(ctx context.Context, e *gomatrixserverlib.Event) error {
|
||||
processEventMutexes.Lock(e.RoomID())
|
||||
defer processEventMutexes.Unlock(e.RoomID())
|
||||
|
||||
logger := util.GetLogger(ctx).WithField("event_id", e.EventID()).WithField("room_id", e.RoomID())
|
||||
t.work = "" // reset from previous event
|
||||
|
||||
|
@ -618,14 +623,9 @@ func checkAllowedByState(e *gomatrixserverlib.Event, stateEvents []*gomatrixserv
|
|||
return gomatrixserverlib.Allowed(e, &authUsingState)
|
||||
}
|
||||
|
||||
var processEventWithMissingStateMutexes = internal.NewMutexByRoom()
|
||||
|
||||
func (t *txnReq) processEventWithMissingState(
|
||||
ctx context.Context, e *gomatrixserverlib.Event, roomVersion gomatrixserverlib.RoomVersion,
|
||||
) error {
|
||||
processEventWithMissingStateMutexes.Lock(string(t.Origin) + e.RoomID())
|
||||
defer processEventWithMissingStateMutexes.Unlock(string(t.Origin) + e.RoomID())
|
||||
|
||||
// Do this with a fresh context, so that we keep working even if the
|
||||
// original request times out. With any luck, by the time the remote
|
||||
// side retries, we'll have fetched the missing state.
|
||||
|
|
Loading…
Reference in a new issue