Skip to content

Commit

Permalink
only reset backoff if stream made progress
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Dec 12, 2023
1 parent cc041b6 commit dd87722
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bgs/fedmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,16 +413,20 @@ 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)
return
}
log.Warnf("connection to %q failed: %s", host.Host, err)
}

if cursor > curCursor {
backoff = 0
}
}
}

Expand Down

0 comments on commit dd87722

Please sign in to comment.