mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Apply backpressure to consumers/synchronous requests to hopefully stop things being overwhelmed
This commit is contained in:
parent
5ed90caaff
commit
c68037b3e8
1 changed files with 4 additions and 2 deletions
|
@ -77,7 +77,8 @@ func (r *Inputer) Start() error {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Inc()
|
roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Inc()
|
||||||
r.workerForRoom(roomID).Act(nil, func() {
|
worker := r.workerForRoom(roomID)
|
||||||
|
worker.Act(worker, func() {
|
||||||
defer roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Dec()
|
defer roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Dec()
|
||||||
if err := r.processRoomEvent(context.TODO(), &inputRoomEvent); err != nil {
|
if err := r.processRoomEvent(context.TODO(), &inputRoomEvent); err != nil {
|
||||||
sentry.CaptureException(err)
|
sentry.CaptureException(err)
|
||||||
|
@ -133,7 +134,8 @@ func (r *Inputer) InputRoomEvents(
|
||||||
inputRoomEvent := e
|
inputRoomEvent := e
|
||||||
roomID := inputRoomEvent.Event.RoomID()
|
roomID := inputRoomEvent.Event.RoomID()
|
||||||
roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Inc()
|
roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Inc()
|
||||||
r.workerForRoom(roomID).Act(nil, func() {
|
worker := r.workerForRoom(roomID)
|
||||||
|
worker.Act(worker, func() {
|
||||||
defer roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Dec()
|
defer roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Dec()
|
||||||
err := r.processRoomEvent(ctx, &inputRoomEvent)
|
err := r.processRoomEvent(ctx, &inputRoomEvent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue