diff --git a/events/event_consumer.go b/events/event_consumer.go index af8793a07..69446a7d7 100644 --- a/events/event_consumer.go +++ b/events/event_consumer.go @@ -4,10 +4,11 @@ import ( "context" "errors" "fmt" - "github.com/sethvargo/go-retry" "sync" "time" + "github.com/sethvargo/go-retry" + "github.com/flanksource/commons/logger" "github.com/flanksource/incident-commander/api" "github.com/flanksource/incident-commander/db" @@ -163,7 +164,7 @@ func (e *EventConsumer) listenToPostgresNotify(pgNotify chan bool) { } func (e *EventConsumer) Listen() { - logger.Infof("Started listening for database notify events") + logger.Infof("Started listening for database notify events: %v", e.WatchEvents) if err := e.Validate(); err != nil { logger.Fatalf("Error starting event consumer: %v", err) diff --git a/events/events.go b/events/events.go index 5289fd3f1..4dd16a5bf 100644 --- a/events/events.go +++ b/events/events.go @@ -63,13 +63,13 @@ func StartConsumers(gormDB *gorm.DB, config Config) { } uniqWatchEvents := set.New[string]() - for _, c := range allConsumers { + for i, c := range allConsumers { for _, we := range c.WatchEvents { if uniqWatchEvents.Contains(we) { logger.Fatalf("Error starting consumers: event[%s] has multiple consumers", we) } } uniqWatchEvents.Add(c.WatchEvents...) - go c.Listen() + go allConsumers[i].Listen() } } diff --git a/events/notifications.go b/events/notifications.go index f65520969..0f6bd5054 100644 --- a/events/notifications.go +++ b/events/notifications.go @@ -251,8 +251,8 @@ func addNotificationEvent(ctx *api.Context, event api.Event) error { } expressionRunner := pkgNotification.ExpressionRunner{ - ResourceID: n.TeamID.String(), - ResourceType: "teams", + ResourceID: id, + ResourceType: "notification", CelEnv: celEnv, }