diff --git a/events/event_consumer.go b/events/event_consumer.go index 69446a7d7..7c95e2a74 100644 --- a/events/event_consumer.go +++ b/events/event_consumer.go @@ -18,7 +18,7 @@ import ( type EventConsumer struct { WatchEvents []string // We process mutliple events and return the failed events - ProcessBatchFunc func(*api.Context, []api.Event) []*api.Event + ProcessBatchFunc func(*api.Context, []api.Event) []api.Event BatchSize int Consumers int DB *gorm.DB diff --git a/events/notifications.go b/events/notifications.go index 0f6bd5054..3d5b02f6c 100644 --- a/events/notifications.go +++ b/events/notifications.go @@ -44,12 +44,12 @@ func NewNotificationSendConsumer(db *gorm.DB) EventConsumer { } } -func processNotificationEvents(ctx *api.Context, events []api.Event) []*api.Event { - var failedEvents []*api.Event +func processNotificationEvents(ctx *api.Context, events []api.Event) []api.Event { + var failedEvents []api.Event for _, e := range events { if err := handleNotificationEvent(ctx, e); err != nil { e.Error = err.Error() - failedEvents = append(failedEvents, &e) + failedEvents = append(failedEvents, e) } } return failedEvents diff --git a/events/responder.go b/events/responder.go index aa50d2b4b..de7a43ff7 100644 --- a/events/responder.go +++ b/events/responder.go @@ -25,12 +25,12 @@ func NewResponderConsumer(db *gorm.DB) EventConsumer { } } -func processResponderEvents(ctx *api.Context, events []api.Event) []*api.Event { - var failedEvents []*api.Event +func processResponderEvents(ctx *api.Context, events []api.Event) []api.Event { + var failedEvents []api.Event for _, e := range events { if err := handleResponderEvent(ctx, e); err != nil { e.Error = err.Error() - failedEvents = append(failedEvents, &e) + failedEvents = append(failedEvents, e) } } return failedEvents diff --git a/events/teams.go b/events/teams.go index 25f9c363c..658dd0d05 100644 --- a/events/teams.go +++ b/events/teams.go @@ -24,12 +24,12 @@ func NewTeamConsumer(db *gorm.DB) EventConsumer { } } -func processTeamEvents(ctx *api.Context, events []api.Event) []*api.Event { - var failedEvents []*api.Event +func processTeamEvents(ctx *api.Context, events []api.Event) []api.Event { + var failedEvents []api.Event for _, e := range events { if err := handleTeamEvent(ctx, e); err != nil { e.Error = err.Error() - failedEvents = append(failedEvents, &e) + failedEvents = append(failedEvents, e) } } return failedEvents diff --git a/events/upstream_push.go b/events/upstream_push.go index 9f5bc70ec..a2612b510 100644 --- a/events/upstream_push.go +++ b/events/upstream_push.go @@ -25,17 +25,17 @@ func NewUpstreamPushConsumer(db *gorm.DB, config Config) EventConsumer { } } -func handleUpstreamPushEvents(ctx *api.Context, events []api.Event) []*api.Event { +func handleUpstreamPushEvents(ctx *api.Context, events []api.Event) []api.Event { if upstreamPushEventHandler == nil { logger.Fatalf("Got push events but host is not configured") } - var failedEvents []*api.Event + var failedEvents []api.Event var eventsToProcess []api.Event for _, e := range events { if e.Name != EventPushQueueCreate { e.Error = fmt.Errorf("Unrecognized event name: %s", e.Name).Error() - failedEvents = append(failedEvents, &e) + failedEvents = append(failedEvents, e) } else { eventsToProcess = append(eventsToProcess, e) } @@ -55,24 +55,24 @@ func newPushToUpstreamEventHandler(conf upstream.UpstreamConfig) *pushToUpstream } } -func addErrorToFailedEvents(events []api.Event, err error) []*api.Event { - var failedEvents []*api.Event +func addErrorToFailedEvents(events []api.Event, err error) []api.Event { + var failedEvents []api.Event for _, e := range events { e.Error = err.Error() - failedEvents = append(failedEvents, &e) + failedEvents = append(failedEvents, e) } return failedEvents } // Run pushes data from decentralized instances to central incident commander -func (t *pushToUpstreamEventHandler) Run(ctx *api.Context, events []api.Event) []*api.Event { +func (t *pushToUpstreamEventHandler) Run(ctx *api.Context, events []api.Event) []api.Event { upstreamMsg := &upstream.PushData{ AgentName: t.conf.AgentName, } gormDB := ctx.DB() - var failedEvents []*api.Event + var failedEvents []api.Event for _, cl := range GroupChangelogsByTables(events) { switch cl.tableName { case "topologies":