diff --git a/cmd/garm-cli/cmd/runner.go b/cmd/garm-cli/cmd/runner.go index 7255526e..ea17ea26 100644 --- a/cmd/garm-cli/cmd/runner.go +++ b/cmd/garm-cli/cmd/runner.go @@ -198,11 +198,11 @@ func init() { func formatInstances(param []params.Instance) { t := table.NewWriter() - header := table.Row{"Name", "Status", "Runner Status", "Pool ID"} + header := table.Row{"Nr", "Name", "Status", "Runner Status", "Pool ID"} t.AppendHeader(header) - for _, inst := range param { - t.AppendRow(table.Row{inst.Name, inst.Status, inst.RunnerStatus, inst.PoolID}) + for idx, inst := range param { + t.AppendRow(table.Row{idx + 1, inst.Name, inst.Status, inst.RunnerStatus, inst.PoolID}) t.AppendSeparator() } fmt.Println(t.Render()) diff --git a/runner/common/pool.go b/runner/common/pool.go index 21ef4359..f3b9d15e 100644 --- a/runner/common/pool.go +++ b/runner/common/pool.go @@ -29,11 +29,9 @@ const ( // clouds for the instance to spin up, download the tools and join gh. PoolToolUpdateInterval = 15 * time.Minute - // UnauthorizedBackoffTimer is the time we wait before making another request - // after getting an unauthorized error from github. It is unlikely that a second - // request will not receive the same error, unless the config is changed with new - // credentials and garm is restarted. - UnauthorizedBackoffTimer = 15 * time.Minute + // BackoffTimer is the time we wait before attempting to make another request + // to the github API. + BackoffTimer = 1 * time.Minute ) //go:generate mockery --all diff --git a/runner/pool/pool.go b/runner/pool/pool.go index 7f2fcb1a..b1d245ab 100644 --- a/runner/pool/pool.go +++ b/runner/pool/pool.go @@ -285,7 +285,7 @@ func (r *basePoolManager) startLoopForFunction(f func() error, interval time.Dur // this worker was stopped. return default: - r.waitForTimeoutOrCanceled(common.UnauthorizedBackoffTimer) + r.waitForTimeoutOrCanceled(common.BackoffTimer) } } } @@ -295,18 +295,16 @@ func (r *basePoolManager) updateTools() error { // Update tools cache. tools, err := r.helper.FetchTools() if err != nil { + r.log("failed to update tools for repo %s: %s", r.helper.String(), err) r.setPoolRunningState(false, err.Error()) - if errors.Is(err, runnerErrors.ErrUnauthorized) { - r.waitForTimeoutOrCanceled(common.UnauthorizedBackoffTimer) - } else { - r.waitForTimeoutOrCanceled(60 * time.Second) - } + r.waitForTimeoutOrCanceled(common.BackoffTimer) return fmt.Errorf("failed to update tools for repo %s: %w", r.helper.String(), err) } r.mux.Lock() r.tools = tools r.mux.Unlock() + r.log("successfully updated tools") r.setPoolRunningState(true, "") return err }