File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -483,6 +483,14 @@ func (p *Processor) Start() error {
483483 }
484484
485485 go func () {
486+ bo := backoff .WithContext (
487+ backoff .WithMaxRetries (
488+ backoff .NewConstantBackOff (p .backOffRetryInterval ),
489+ p .backOffMaxRetries ,
490+ ),
491+ ctx ,
492+ )
493+
486494 if err := backoff .Retry (func () error {
487495 slog .Info ("attempting backoff queue subscription" )
488496 if err := p .queue .Subscribe (ctx , p .msgCh , & p .wg ); err != nil {
@@ -491,7 +499,7 @@ func (p *Processor) Start() error {
491499 }
492500
493501 return nil
494- }, backoff . WithContext ( backoff . NewConstantBackOff ( 1 * time . Second ), ctx ) ); err != nil {
502+ }, bo ); err != nil {
495503 slog .Error ("rabbitmq subscribe backoff retry error" , "err" , err .Error ())
496504 }
497505 }()
Original file line number Diff line number Diff line change @@ -221,6 +221,14 @@ func (w *Watchdog) Start() error {
221221 }
222222
223223 go func () {
224+ bo := backoff .WithContext (
225+ backoff .WithMaxRetries (
226+ backoff .NewConstantBackOff (w .backOffRetryInterval ),
227+ w .backOffMaxRetries ,
228+ ),
229+ ctx ,
230+ )
231+
224232 if err := backoff .Retry (func () error {
225233 slog .Info ("attempting backoff queue subscription" )
226234 if err := w .queue .Subscribe (ctx , w .msgCh , & w .wg ); err != nil {
@@ -229,7 +237,7 @@ func (w *Watchdog) Start() error {
229237 }
230238
231239 return nil
232- }, backoff . WithContext ( backoff . NewConstantBackOff ( 1 * time . Second ), ctx ) ); err != nil {
240+ }, bo ); err != nil {
233241 slog .Error ("rabbitmq subscribe backoff retry error" , "err" , err .Error ())
234242 }
235243 }()
You can’t perform that action at this time.
0 commit comments