diff --git a/ghbackup/run.go b/ghbackup/run.go index 8dcbcf4..205adc0 100644 --- a/ghbackup/run.go +++ b/ghbackup/run.go @@ -6,17 +6,8 @@ import ( "log" "net/http" "time" - - "github.com/cenkalti/backoff" ) -func newExponentialBackOff() *backoff.ExponentialBackOff { - b := backoff.NewExponentialBackOff() - b.InitialInterval = 1 * time.Second - b.MaxElapsedTime = 5 * time.Minute - return b -} - // Run update for the given Config. func Run(config Config) error { // Defaults @@ -48,17 +39,15 @@ func Run(config Config) error { // Backup repositories in parallel with exponential-backoff retries go each(repos, config.Workers, func(r repo) { - eBackoff := newExponentialBackOff() state, err := config.backup(r) - for { + for _, sleepDuration := range []time.Duration{5, 15, 45, 90, 180, -1} { if err != nil { - sleepDuration := eBackoff.NextBackOff() - if sleepDuration == backoff.Stop { + if sleepDuration == -1 { config.Log.Printf("repository %v failed to get cloned: %v", r, err) break } config.Err.Println(err) - time.Sleep(sleepDuration) + time.Sleep(sleepDuration * time.Second) state, err = config.backup(r) continue }