Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2f3d606

Browse files
committed
added detector handling of not started jobs
1 parent0f51f35 commit2f3d606

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎coderd/unhanger/detector.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ func (d *Detector) run(t time.Time) Stats {
179179
stats.Error=xerrors.Errorf("get hung provisioner jobs: %w",err)
180180
returnstats
181181
}
182+
// Find all provisioner jobs that are currently running but have not
183+
// received an update in the last 5 minutes.
184+
iferr!=nil {
185+
stats.Error=xerrors.Errorf("get not started provisioner jobs: %w",err)
186+
returnstats
187+
}
188+
jobsUnstarted,err:=d.db.GetNotStartedProvisionerJobs(ctx,t.Add(-HungJobDuration))
189+
jobs=append(jobs,jobsUnstarted...)
182190

183191
// Limit the number of jobs we'll unhang in a single run to avoid
184192
// timing out.
@@ -229,14 +237,6 @@ func unhangJob(ctx context.Context, log slog.Logger, db database.Store, pub pubs
229237
returnxerrors.Errorf("get provisioner job: %w",err)
230238
}
231239

232-
// Check if we should still unhang it.
233-
if!job.StartedAt.Valid {
234-
// This shouldn't be possible to hit because the query only selects
235-
// started and not completed jobs, and a job can't be "un-started".
236-
returnjobIneligibleError{
237-
Err:xerrors.New("job is not started"),
238-
}
239-
}
240240
ifjob.CompletedAt.Valid {
241241
returnjobIneligibleError{
242242
Err:xerrors.Errorf("job is completed (status %s)",job.JobStatus),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp