Skip to content

Commit

Permalink
reduce kafka topics for care partner alerts outside of production
Browse files Browse the repository at this point in the history
As requested in code review.

tidepool-org/terraform-modules#72 (review)

BACK-2559
  • Loading branch information
ewollesen committed Feb 4, 2025
1 parent 9562b32 commit 239f89c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions data/service/service/standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,12 @@ func (s *Standard) initializeAlertsEventsHandler() error {
},
}

eventsRunner := dataEvents.NewCascadingSaramaEventsRunner(runnerCfg, s.Logger(),
[]time.Duration{0, 1 * time.Second, 2 * time.Second, 3 * time.Second, 5 * time.Second})
retryDelays := []time.Duration{0, 1 * time.Second}
if strings.Contains(commonConfig.KafkaTopicPrefix, "tidepool-prod") {
// Kakfa topics/partitions aren't cheap, so minimize costs outside of production.
retryDelays = append(retryDelays, 2*time.Second, 3*time.Second, 5*time.Second)
}
eventsRunner := dataEvents.NewCascadingSaramaEventsRunner(runnerCfg, s.Logger(), retryDelays)
runner := dataEvents.NewSaramaRunner(eventsRunner)
if err := runner.Initialize(); err != nil {
return errors.Wrap(err, "Unable to initialize alerts events handler runner")
Expand Down

0 comments on commit 239f89c

Please sign in to comment.