diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-11-16 15:44:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-16 15:44:53 +0000 |
commit | 20a01bceb2869c810932eac217d96dc221953685 (patch) | |
tree | 639cd8656282ae231a46531f063d7d010320a582 /appservice/consumers | |
parent | d8b526b603683879c012972707cdce44fff3c802 (diff) |
Pass pointers to events — reloaded (#1583)
* Pass events as pointers
* Fix lint errors
* Update gomatrixserverlib
* Update gomatrixserverlib
* Update to matrix-org/gomatrixserverlib#240
Diffstat (limited to 'appservice/consumers')
-rw-r--r-- | appservice/consumers/roomserver.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/appservice/consumers/roomserver.go b/appservice/consumers/roomserver.go index 560cd237..4f6b4b4d 100644 --- a/appservice/consumers/roomserver.go +++ b/appservice/consumers/roomserver.go @@ -88,7 +88,7 @@ func (s *OutputRoomEventConsumer) onMessage(msg *sarama.ConsumerMessage) error { return nil } - events := []gomatrixserverlib.HeaderedEvent{output.NewRoomEvent.Event} + events := []*gomatrixserverlib.HeaderedEvent{output.NewRoomEvent.Event} events = append(events, output.NewRoomEvent.AddStateEvents...) // Send event to any relevant application services @@ -102,14 +102,14 @@ func (s *OutputRoomEventConsumer) onMessage(msg *sarama.ConsumerMessage) error { // application service. func (s *OutputRoomEventConsumer) filterRoomserverEvents( ctx context.Context, - events []gomatrixserverlib.HeaderedEvent, + events []*gomatrixserverlib.HeaderedEvent, ) error { for _, ws := range s.workerStates { for _, event := range events { // Check if this event is interesting to this application service if s.appserviceIsInterestedInEvent(ctx, event, ws.AppService) { // Queue this event to be sent off to the application service - if err := s.asDB.StoreEvent(ctx, ws.AppService.ID, &event); err != nil { + if err := s.asDB.StoreEvent(ctx, ws.AppService.ID, event); err != nil { log.WithError(err).Warn("failed to insert incoming event into appservices database") } else { // Tell our worker to send out new messages by updating remaining message @@ -125,7 +125,7 @@ func (s *OutputRoomEventConsumer) filterRoomserverEvents( // appserviceIsInterestedInEvent returns a boolean depending on whether a given // event falls within one of a given application service's namespaces. -func (s *OutputRoomEventConsumer) appserviceIsInterestedInEvent(ctx context.Context, event gomatrixserverlib.HeaderedEvent, appservice config.ApplicationService) bool { +func (s *OutputRoomEventConsumer) appserviceIsInterestedInEvent(ctx context.Context, event *gomatrixserverlib.HeaderedEvent, appservice config.ApplicationService) bool { // No reason to queue events if they'll never be sent to the application // service if appservice.URL == "" { |