Skip to content

Commit

Permalink
avoid starvation by configuring max. number of retries of an event (b…
Browse files Browse the repository at this point in the history
…ackoff is exponential in nsq by default) and increase concurrency by processing at most two events at a time
  • Loading branch information
mwindower committed Jul 9, 2024
1 parent 6fe8436 commit 1ed6c09
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/bmc/nsq.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ func (b *BMCService) InitConsumer() error {
MinVersion: tls.VersionTLS12,
}
config.TlsV1 = true
config.MaxAttempts = 3
config.MaxInFlight = 2

consumer, err := nsq.NewConsumer(b.machineTopic, mqChannel, config)
if err != nil {
return err
}

consumer.SetLogger(nsqLogger{log: b.log}, nsqMapLevel(b.log))

consumer.AddHandler(b)

err = consumer.ConnectToNSQD(b.mqAddress)
Expand Down

0 comments on commit 1ed6c09

Please sign in to comment.