mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-03-03 17:03:10 -06:00
Tweak that some more
This commit is contained in:
parent
ea115539ef
commit
10dd3a7c2a
|
|
@ -104,17 +104,14 @@ func (s *OutputRoomEventConsumer) onMessage(
|
||||||
if err := json.Unmarshal(msg.Data, &output); err != nil {
|
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
|
// If the message was invalid, log it and move on to the next message in the stream
|
||||||
log.WithField("appservice", state.ID).WithError(err).Errorf("Appservice failed to parse message, ignoring")
|
log.WithField("appservice", state.ID).WithError(err).Errorf("Appservice failed to parse message, ignoring")
|
||||||
_ = msg.Ack()
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch output.Type {
|
switch output.Type {
|
||||||
case api.OutputTypeNewRoomEvent:
|
case api.OutputTypeNewRoomEvent:
|
||||||
if output.NewRoomEvent == nil {
|
if output.NewRoomEvent == nil {
|
||||||
_ = msg.Ack()
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !s.appserviceIsInterestedInEvent(ctx, output.NewRoomEvent.Event, state.ApplicationService) {
|
if !s.appserviceIsInterestedInEvent(ctx, output.NewRoomEvent.Event, state.ApplicationService) {
|
||||||
_ = msg.Ack()
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
events = append(events, output.NewRoomEvent.Event)
|
events = append(events, output.NewRoomEvent.Event)
|
||||||
|
|
@ -145,21 +142,20 @@ func (s *OutputRoomEventConsumer) onMessage(
|
||||||
events = append(events, output.NewInviteEvent.Event)
|
events = append(events, output.NewInviteEvent.Event)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_ = msg.Ack()
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are no events selected for sending then we should
|
// If there are no events selected for sending then we should
|
||||||
// negatively ack the pending events so we will retry them again
|
// ack the events so that we don't get sent them again in the
|
||||||
// later.
|
// future.
|
||||||
if len(events) == 0 {
|
if len(events) == 0 {
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send event to any relevant application services
|
// Send event to any relevant application services
|
||||||
if err := s.sendEvents(ctx, state, events); err != nil {
|
if err := s.sendEvents(ctx, state, events); err != nil {
|
||||||
log.WithField("appservice", state.ID).WithError(err).Errorf("Appservice failed to filter events")
|
log.WithField("appservice", state.ID).WithError(err).Errorf("Appservice failed to send events")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue