Skip to content

Commit

Permalink
chore: use different consumer for notification_send
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Jul 27, 2023
1 parent 6045e54 commit 16ba49e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func StartConsumers(gormDB *gorm.DB, config Config) {
allConsumers := []EventConsumer{
NewTeamConsumer(gormDB),
NewNotificationConsumer(gormDB),
NewNotificationSendConsumer(gormDB),
NewResponderConsumer(gormDB),
}
if config.UpstreamPush.Valid() {
Expand Down
10 changes: 10 additions & 0 deletions events/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ func NewNotificationConsumer(db *gorm.DB) EventConsumer {
}
}

func NewNotificationSendConsumer(db *gorm.DB) EventConsumer {
return EventConsumer{
WatchEvents: []string{EventNotificationSend},
ProcessBatchFunc: processNotificationEvents,
BatchSize: 1,
Consumers: 5,
DB: db,
}
}

func processNotificationEvents(ctx *api.Context, events []api.Event) []*api.Event {
var failedEvents []*api.Event
for _, e := range events {
Expand Down

0 comments on commit 16ba49e

Please sign in to comment.