Skip to content

Commit

Permalink
Try to slow things down
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Jun 28, 2021
1 parent 8866120 commit b97d406
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion federationapi/routing/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,13 +620,18 @@ func checkAllowedByState(e *gomatrixserverlib.Event, stateEvents []*gomatrixserv
return gomatrixserverlib.Allowed(e, &authUsingState)
}

var processEventWithMissingStateMutex sync.Mutex

func (t *txnReq) processEventWithMissingState(
ctx context.Context, e *gomatrixserverlib.Event, roomVersion gomatrixserverlib.RoomVersion,
) error {
processEventWithMissingStateMutex.Lock()
defer processEventWithMissingStateMutex.Unlock()

// 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.
gmectx, cancel := context.WithTimeout(context.Background(), time.Minute*5)
gmectx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
// We are missing the previous events for this events.
// This means that there is a gap in our view of the history of the
Expand Down

0 comments on commit b97d406

Please sign in to comment.