10 seconds to deal with an event

This commit is contained in:
Neil Alexander 2021-06-28 12:21:24 +01:00
parent 8fd878c75a
commit 73c9c7d798
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -498,6 +498,9 @@ 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 {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, time.Second*10)
defer cancel()
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