mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Add RoomEventType
nats.Header to avoid unneeded unmarshalling (#2765)
This commit is contained in:
parent
ebd137cf6b
commit
8c0c3441d8
6 changed files with 30 additions and 18 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue