Skip to content

Commit

Permalink
improve bootstrapper resilience
Browse files Browse the repository at this point in the history
  • Loading branch information
acud committed Jul 30, 2024
1 parent f46277b commit 9331220
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/systest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
test_name:
description: "Test to run"
default: "."
default: "TestCheckpoint"
log_level:
description: "Log level"
default: "debug"
Expand Down
33 changes: 31 additions & 2 deletions cmd/bootstrapper/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,37 @@ func (s *Server) Start(ctx context.Context, errCh chan error, params *NetworkPar
// start generating fallback data
s.eg.Go(
func() error {
s.genDataLoop(ctx, errCh, last, params.updateActiveSetTime, s.GenFallbackActiveSet)
return nil
var (
errs = 0
maxErrs = 10
timer *time.Timer
backoff = 10 * time.Second
)
for epoch := last; ; epoch++ {
wait := time.Until(params.updateActiveSetTime(epoch))
select {
case <-timer.C:
if err := s.GenFallbackActiveSet(ctx, epoch); err != nil {
errs++
timer.Reset(backoff)
continue
}
errs = 0
if !timer.Stop() {
<-timer.C
}
case <-time.After(wait):
if err := s.GenFallbackActiveSet(ctx, epoch); err != nil {
timer = time.NewTimer(backoff)
if errs >= maxErrs {
errCh <- err
return err
}
}
case <-ctx.Done():
return ctx.Err()
}
}
})
s.eg.Go(
func() error {
Expand Down

0 comments on commit 9331220

Please sign in to comment.