From cc041b6d84e8559b314821571703f8a9523b95a5 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Sun, 10 Dec 2023 21:36:07 -0800 Subject: [PATCH 1/2] reset backoff after successful connection in fedmgr --- bgs/fedmgr.go | 1 + 1 file changed, 1 insertion(+) diff --git a/bgs/fedmgr.go b/bgs/fedmgr.go index b71f713e6..be311985f 100644 --- a/bgs/fedmgr.go +++ b/bgs/fedmgr.go @@ -413,6 +413,7 @@ func (s *Slurper) subscribeWithRedialer(ctx context.Context, host *models.PDS, s continue } + backoff = 0 // reset backoff on successful connection log.Info("event subscription response code: ", res.StatusCode) if err := s.handleConnection(ctx, host, con, &cursor, sub); err != nil { From dd87722a8cf64d1bafebc5205571b475ccc07438 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Tue, 12 Dec 2023 09:58:49 -0800 Subject: [PATCH 2/2] only reset backoff if stream made progress --- bgs/fedmgr.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bgs/fedmgr.go b/bgs/fedmgr.go index be311985f..c5c5f500c 100644 --- a/bgs/fedmgr.go +++ b/bgs/fedmgr.go @@ -413,9 +413,9 @@ func (s *Slurper) subscribeWithRedialer(ctx context.Context, host *models.PDS, s continue } - backoff = 0 // reset backoff on successful connection log.Info("event subscription response code: ", res.StatusCode) + curCursor := cursor if err := s.handleConnection(ctx, host, con, &cursor, sub); err != nil { if errors.Is(err, ErrTimeoutShutdown) { log.Infof("shutting down pds subscription to %s, no activity after %s", host.Host, EventsTimeout) @@ -423,6 +423,10 @@ func (s *Slurper) subscribeWithRedialer(ctx context.Context, host *models.PDS, s } log.Warnf("connection to %q failed: %s", host.Host, err) } + + if cursor > curCursor { + backoff = 0 + } } }