Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small adjustments #203

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions runner/common/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const (
PoolReapTimeoutInterval = 5 * time.Minute
// Temporary tools download token is valid for 1 hour by default.
// There is no point in making an API call to get available tools, for every runner
// we spin up. We cache the tools for one minute. This should save us a lot of API calls
// we spin up. We cache the tools for 5 minutes. This should save us a lot of API calls
// in cases where we have a lot of runners spin up at the same time.
PoolToolUpdateInterval = 1 * time.Minute
PoolToolUpdateInterval = 5 * time.Minute

// BackoffTimer is the time we wait before attempting to make another request
// to the github API.
Expand Down
6 changes: 0 additions & 6 deletions runner/providers/external/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ func (e *external) validateResult(ctx context.Context, inst commonParams.Provide
return garmErrors.NewProviderError("missing instance name")
}

if inst.OSName == "" || inst.OSArch == "" || inst.OSType == "" {
// we can still function without this info (I think)
slog.WarnContext(
ctx, "missing OS information",
"instance", inst.Name)
}
if !IsValidProviderStatus(inst.Status) {
return garmErrors.NewProviderError("invalid status returned (%s)", inst.Status)
}
Expand Down
8 changes: 7 additions & 1 deletion runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,13 @@ func (r *Runner) DeleteRunner(ctx context.Context, instanceName string, forceDel
case commonParams.InstanceRunning, commonParams.InstanceError,
commonParams.InstancePendingForceDelete, commonParams.InstancePendingDelete:
default:
return runnerErrors.NewBadRequestError("runner must be in %q or %q state", commonParams.InstanceRunning, commonParams.InstanceError)
validStates := []string{
string(commonParams.InstanceRunning),
string(commonParams.InstanceError),
string(commonParams.InstancePendingForceDelete),
string(commonParams.InstancePendingDelete),
}
return runnerErrors.NewBadRequestError("runner must be in one of the following states: %q", strings.Join(validStates, ", "))
}

poolMgr, err := r.getPoolManagerFromInstance(ctx, instance)
Expand Down
11 changes: 4 additions & 7 deletions websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,14 @@ func (h *Hub) Close() error {

func (h *Hub) Stop() error {
h.Close()
select {
case <-h.closed:
return nil
case <-time.After(60 * time.Second):
return fmt.Errorf("timed out waiting for hub stop")
}
return h.Wait()
}

func (h *Hub) Wait() {
func (h *Hub) Wait() error {
select {
case <-h.closed:
case <-time.After(60 * time.Second):
return fmt.Errorf("timed out waiting for hub stop")
}
return nil
}
Loading