aboutsummaryrefslogtreecommitdiff
path: root/appservice/consumers/roomserver.go
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2022-10-05 12:12:42 +0200
committerGitHub <noreply@github.com>2022-10-05 12:12:42 +0200
commit8c0c3441d88a612ca8e9ba4f83c6ff29ca73f5d0 (patch)
tree74b355bf97be6ad1b82cf89d16d564105f5373de /appservice/consumers/roomserver.go
parentebd137cf6b2fbd767625dc5289b0bef6d1e51971 (diff)
Add `RoomEventType` nats.Header to avoid unneeded unmarshalling (#2765)
Diffstat (limited to 'appservice/consumers/roomserver.go')
-rw-r--r--appservice/consumers/roomserver.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/appservice/consumers/roomserver.go b/appservice/consumers/roomserver.go
index d44f32b3..ac68f4bd 100644
--- a/appservice/consumers/roomserver.go
+++ b/appservice/consumers/roomserver.go
@@ -101,6 +101,11 @@ func (s *OutputRoomEventConsumer) onMessage(
log.WithField("appservice", state.ID).Tracef("Appservice worker received %d message(s) from roomserver", len(msgs))
events := make([]*gomatrixserverlib.HeaderedEvent, 0, len(msgs))
for _, msg := range msgs {
+ // Only handle events we care about
+ receivedType := api.OutputType(msg.Header.Get(jetstream.RoomEventType))
+ if receivedType != api.OutputTypeNewRoomEvent && receivedType != api.OutputTypeNewInviteEvent {
+ continue
+ }
// Parse out the event JSON
var output api.OutputEvent
if err := json.Unmarshal(msg.Data, &output); err != nil {