mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-26 06:58:27 +00:00
More tweaks
This commit is contained in:
parent
bcda9729e4
commit
da78cd909c
2 changed files with 2 additions and 12 deletions
|
@ -276,6 +276,7 @@ NextPDU:
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func fromStateTuples(tuples []gomatrixserverlib.StateKeyTuple, omitTuples []gomatrixserverlib.StateKeyTuple) (result []*gomatrixserverlib.HeaderedEvent) {
|
||||
NextTuple:
|
||||
for _, t := range tuples {
|
||||
|
@ -291,6 +292,7 @@ NextTuple:
|
|||
}
|
||||
return
|
||||
}
|
||||
*/
|
||||
|
||||
func assertInputRoomEvents(t *testing.T, got []api.InputRoomEvent, want []*gomatrixserverlib.HeaderedEvent) {
|
||||
for _, g := range got {
|
||||
|
|
|
@ -33,7 +33,6 @@ import (
|
|||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/nats-io/nats.go"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/sirupsen/logrus"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
@ -67,8 +66,6 @@ func (r *Inputer) workerForRoom(roomID string) *phony.Inbox {
|
|||
return inbox.(*phony.Inbox)
|
||||
}
|
||||
|
||||
var eventIDsQueued sync.Map
|
||||
|
||||
// onMessage is called when a new event arrives in the roomserver input stream.
|
||||
func (r *Inputer) Start() error {
|
||||
_, err := r.JetStream.Subscribe(
|
||||
|
@ -84,19 +81,10 @@ func (r *Inputer) Start() error {
|
|||
return
|
||||
}
|
||||
|
||||
eventID := inputRoomEvent.Event.EventID()
|
||||
_, existed := eventIDsQueued.LoadOrStore(eventID, struct{}{})
|
||||
if existed {
|
||||
logrus.Errorf("XXX: We already received event ID %s", eventID)
|
||||
_ = msg.Term()
|
||||
return
|
||||
}
|
||||
|
||||
_ = msg.InProgress()
|
||||
roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Inc()
|
||||
r.workerForRoom(roomID).Act(nil, func() {
|
||||
_ = msg.InProgress() // resets the acknowledgement wait timer
|
||||
defer eventIDsQueued.Delete(eventID)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), MaximumProcessingTime)
|
||||
defer cancel()
|
||||
defer roomserverInputBackpressure.With(prometheus.Labels{"room_id": roomID}).Dec()
|
||||
|
|
Loading…
Reference in a new issue