Skip to content

Commit ff7ed10

Browse files
authored
fix(relayer): honor backoff config for queue subscriptions (#21124)
1 parent f2ca521 commit ff7ed10

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

packages/relayer/processor/processor.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}()

packages/relayer/watchdog/watchdog.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}()

0 commit comments

Comments
 (0)