Ack tweaks

This commit is contained in:
Neil Alexander 2021-11-03 15:57:36 +00:00
parent eb07c2d5d7
commit 134ec18614
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
9 changed files with 28 additions and 28 deletions

View file

@ -74,7 +74,7 @@ func (s *OutputClientDataConsumer) onMessage(msg *nats.Msg) {
// If the message was invalid, log it and move on to the next message in the stream
log.WithError(err).Errorf("client API server output log: message parse failure")
sentry.CaptureException(err)
_ = msg.Nak()
_ = msg.Ack()
return
}

View file

@ -70,7 +70,7 @@ func (s *OutputReceiptEventConsumer) onMessage(msg *nats.Msg) {
// If the message was invalid, log it and move on to the next message in the stream
log.WithError(err).Errorf("EDU server output log: message parse failure")
sentry.CaptureException(err)
_ = msg.Nak()
_ = msg.Ack()
return
}

View file

@ -74,18 +74,18 @@ func (s *OutputSendToDeviceEventConsumer) onMessage(msg *nats.Msg) {
// If the message was invalid, log it and move on to the next message in the stream
log.WithError(err).Errorf("EDU server output log: message parse failure")
sentry.CaptureException(err)
_ = msg.Nak()
_ = msg.Ack()
return
}
_, domain, err := gomatrixserverlib.SplitID('@', output.UserID)
if err != nil {
sentry.CaptureException(err)
_ = msg.Nak()
_ = msg.Ack()
return
}
if domain != s.serverName {
_ = msg.Nak()
_ = msg.Ack()
return
}

View file

@ -71,7 +71,7 @@ func (s *OutputTypingEventConsumer) onMessage(msg *nats.Msg) {
// If the message was invalid, log it and move on to the next message in the stream
log.WithError(err).Errorf("EDU server output log: message parse failure")
sentry.CaptureException(err)
_ = msg.Nak()
_ = msg.Ack()
return
}

View file

@ -83,7 +83,7 @@ func (s *OutputRoomEventConsumer) onMessage(msg *nats.Msg) {
if err = json.Unmarshal(msg.Data, &output); err != nil {
// If the message was invalid, log it and move on to the next message in the stream
log.WithError(err).Errorf("roomserver output log: message parse failure")
_ = msg.Nak()
_ = msg.Ack()
return
}
@ -96,6 +96,7 @@ func (s *OutputRoomEventConsumer) onMessage(msg *nats.Msg) {
// in the special case where the event redacts itself, just pass the message through because
// we will never see the other part of the pair
if event.Redacts() != event.EventID() {
_ = msg.Ack()
return
}
}
@ -116,7 +117,7 @@ func (s *OutputRoomEventConsumer) onMessage(msg *nats.Msg) {
log.WithField("type", output.Type).Debug(
"roomserver output log: ignoring unknown output type",
)
_ = msg.Nak()
_ = msg.Ack()
}
if err != nil {
log.WithError(err).Error("roomserver output log: failed to process event")