pkg/retry/retry.go
func (r *Retrier) RunRetry() error {
	// Start signal handler.
	sigHandler := signals.NewSignalHandler(10)
	go sigHandler.Register()

	finish := make(chan bool, 1)
	go func() {
		select {
		case <-finish:
			return
		case <-time.After(10 * time.Second):
			return
		default:
			for {
				if sigHandler.GetState() != 0 {
					logger.Critical("detected signal. retry failed.")
					os.Exit(1)
				}
			}
		}
	}()

	for i := 0; i < r.retries; i++ {
		err := r.retryable.Try()
		if err != nil {
			logger.Info("Retryable error: %v", err)
			time.Sleep(time.Duration(r.sleepSeconds) * time.Second)
			continue
		}
		finish <- true
		return nil
	}

	finish <- true
	return fmt.Errorf("unable to succeed at retry after %d attempts at %d seconds", r.retries, r.sleepSeconds)
}
func (r *Retrier) RunRetry() error {
	// Start signal handler.
	sigHandler := signals.NewSignalHandler(10)
	go sigHandler.Register()

	finish := make(chan bool, 1)
	go func() {
		select {
		case <-finish:
			return
		case <-time.After(10 * time.Second):
			return
		default:
			for {
				if sigHandler.GetState() != 0 {
					logger.Critical("detected signal. retry failed.")
					os.Exit(1)
				}
			}
		}
	}()

	for i := 0; i < r.retries; i++ {
		err := r.retryable.Try()
		if err != nil {
			logger.Info("Retryable error: %v", err)
			time.Sleep(time.Duration(r.sleepSeconds) * time.Second)
			continue
		}
		finish <- true
		return nil
	}

	finish <- true
	return fmt.Errorf("unable to succeed at retry after %d attempts at %d seconds", r.retries, r.sleepSeconds)
}
// RunRetry runs a retryable function.