mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 19:03:09 -06:00
Fix up event filtering
This commit is contained in:
parent
79754a2ab7
commit
9f863de5d6
|
|
@ -113,12 +113,8 @@ func (s *OutputRoomEventConsumer) onMessage(msg *sarama.ConsumerMessage) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if any events need to passed on to external application services
|
// Combine any state and non-state events and send them to the application service
|
||||||
if len(events) > 0 {
|
return s.filterRoomserverEvents(ctx, ev)
|
||||||
// Check if this was a membership event
|
|
||||||
return s.filterRoomserverEvents(ctx, events)
|
|
||||||
}
|
|
||||||
return s.filterRoomserverEvents(ctx, append(events, ev))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookupStateEvents looks up the state events that are added by a new event.
|
// lookupStateEvents looks up the state events that are added by a new event.
|
||||||
|
|
@ -172,9 +168,8 @@ func (s *OutputRoomEventConsumer) lookupStateEvents(
|
||||||
// application service.
|
// application service.
|
||||||
func (s *OutputRoomEventConsumer) filterRoomserverEvents(
|
func (s *OutputRoomEventConsumer) filterRoomserverEvents(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
events []gomatrixserverlib.Event,
|
event gomatrixserverlib.Event,
|
||||||
) error {
|
) error {
|
||||||
for _, event := range events {
|
|
||||||
for _, ws := range s.workerStates {
|
for _, ws := range s.workerStates {
|
||||||
// Check if this event is interesting to this application service
|
// Check if this event is interesting to this application service
|
||||||
if s.appserviceIsInterestedInEvent(ctx, event, ws.AppService) {
|
if s.appserviceIsInterestedInEvent(ctx, event, ws.AppService) {
|
||||||
|
|
@ -188,7 +183,6 @@ func (s *OutputRoomEventConsumer) filterRoomserverEvents(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue