aboutsummaryrefslogtreecommitdiff
path: root/syncapi/consumers
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-11-16 15:44:53 +0000
committerGitHub <noreply@github.com>2020-11-16 15:44:53 +0000
commit20a01bceb2869c810932eac217d96dc221953685 (patch)
tree639cd8656282ae231a46531f063d7d010320a582 /syncapi/consumers
parentd8b526b603683879c012972707cdce44fff3c802 (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 'syncapi/consumers')
-rw-r--r--syncapi/consumers/roomserver.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/syncapi/consumers/roomserver.go b/syncapi/consumers/roomserver.go
index ac1128c1..05f32a83 100644
--- a/syncapi/consumers/roomserver.go
+++ b/syncapi/consumers/roomserver.go
@@ -118,7 +118,7 @@ func (s *OutputRoomEventConsumer) onMessage(msg *sarama.ConsumerMessage) error {
func (s *OutputRoomEventConsumer) onRedactEvent(
ctx context.Context, msg api.OutputRedactedEvent,
) error {
- err := s.db.RedactEvent(ctx, msg.RedactedEventID, &msg.RedactedBecause)
+ err := s.db.RedactEvent(ctx, msg.RedactedEventID, msg.RedactedBecause)
if err != nil {
log.WithError(err).Error("RedactEvent error'd")
return err
@@ -156,7 +156,7 @@ func (s *OutputRoomEventConsumer) onNewRoomEvent(
pduPos, err := s.db.WriteEvent(
ctx,
- &ev,
+ ev,
addsStateEvents,
msg.AddsStateEventIDs,
msg.RemovesStateEventIDs,
@@ -174,12 +174,12 @@ func (s *OutputRoomEventConsumer) onNewRoomEvent(
return nil
}
- if pduPos, err = s.notifyJoinedPeeks(ctx, &ev, pduPos); err != nil {
+ if pduPos, err = s.notifyJoinedPeeks(ctx, ev, pduPos); err != nil {
logrus.WithError(err).Errorf("Failed to notifyJoinedPeeks for PDU pos %d", pduPos)
return err
}
- s.notifier.OnNewEvent(&ev, "", nil, types.NewStreamToken(pduPos, 0, nil))
+ s.notifier.OnNewEvent(ev, "", nil, types.NewStreamToken(pduPos, 0, nil))
return nil
}
@@ -197,8 +197,8 @@ func (s *OutputRoomEventConsumer) onOldRoomEvent(
// from confusing clients into thinking they've joined/left rooms.
pduPos, err := s.db.WriteEvent(
ctx,
- &ev,
- []gomatrixserverlib.HeaderedEvent{},
+ ev,
+ []*gomatrixserverlib.HeaderedEvent{},
[]string{}, // adds no state
[]string{}, // removes no state
nil, // no transaction
@@ -213,12 +213,12 @@ func (s *OutputRoomEventConsumer) onOldRoomEvent(
return nil
}
- if pduPos, err = s.notifyJoinedPeeks(ctx, &ev, pduPos); err != nil {
+ if pduPos, err = s.notifyJoinedPeeks(ctx, ev, pduPos); err != nil {
logrus.WithError(err).Errorf("Failed to notifyJoinedPeeks for PDU pos %d", pduPos)
return err
}
- s.notifier.OnNewEvent(&ev, "", nil, types.NewStreamToken(pduPos, 0, nil))
+ s.notifier.OnNewEvent(ev, "", nil, types.NewStreamToken(pduPos, 0, nil))
return nil
}
@@ -267,7 +267,7 @@ func (s *OutputRoomEventConsumer) onNewInviteEvent(
}).Panicf("roomserver output log: write invite failure")
return nil
}
- s.notifier.OnNewEvent(&msg.Event, "", nil, types.NewStreamToken(pduPos, 0, nil))
+ s.notifier.OnNewEvent(msg.Event, "", nil, types.NewStreamToken(pduPos, 0, nil))
return nil
}
@@ -309,7 +309,7 @@ func (s *OutputRoomEventConsumer) onNewPeek(
return nil
}
-func (s *OutputRoomEventConsumer) updateStateEvent(event gomatrixserverlib.HeaderedEvent) (gomatrixserverlib.HeaderedEvent, error) {
+func (s *OutputRoomEventConsumer) updateStateEvent(event *gomatrixserverlib.HeaderedEvent) (*gomatrixserverlib.HeaderedEvent, error) {
if event.StateKey() == nil {
return event, nil
}