Open alfred-stokespace opened 1 month ago
I noticed that the dependencies of your project already include github.com/cenkalti/backoff/v4
I opted to use that existing dependency rather than add a new one.
I wrapped the listRunners call with something like this ...
func RetryAbleListRunners(ctx context.Context, client *github.Client, owner, repo string, opts *github.ListOptions) (*github.Runners, *github.Response, error) {
f := func() (*github.Runners, *github.Response, error) {
return listRunners(ctx, client, owner, repo, opts)
}
return RetryingFunction(ctx, f, owner, repo)
}
a call to that function replaces this line https://github.com/whywaita/myshoes/blob/cbe7edaf8e54aa48e4acb7d6197d447d1287ef6e/pkg/gh/runner.go#L48
The RetryFunction establishes a back off timer ...
func GetBackoffTimer(ctx context.Context, maxRetry uint64) backoff.BackOff {
off := backoff.NewExponentialBackOff()
off.InitialInterval = 1 * time.Second
off.Multiplier = 2
off.MaxElapsedTime = 10 * time.Second
off.NextBackOff() // burn one, no matter what I do I can't get the initial to be one second!?
b := backoff.WithMaxRetries(backoff.WithContext(off, ctx), maxRetry)
return b
}
... so far so good, hope this helps.
A user in my org contacted me with a job that never ran.
I found an error message like this ...
I tracked that error down to call to list runners for the org. https://github.com/whywaita/myshoes/blob/cbe7edaf8e54aa48e4acb7d6197d447d1287ef6e/pkg/gh/runner.go#L48
in this particular case the trace is starting at starter.go in function ProcessJob where "Strict" config is true on a call to "checkRegisteredRunner".
The result of this 503 is deleteInstance is called in ProcessJob.
The overall impact of that error is that the runner is deleted. This lead to the job not getting worked on.
I contacted GitHub Enterprise support and they responded with the following suggestion...
I'll add a comment with how I mitigated w/code change.