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

Commit4b252eb

Browse files
committed
filling out started_at when unhanging not started jobs
1 parent2f3d606 commit4b252eb

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

‎coderd/database/queries.sql.go

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/provisionerjobs.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ SET
252252
updated_at= $2,
253253
completed_at= $3,
254254
error= $4,
255-
error_code= $5
255+
error_code= $5,
256+
started_at= $6
256257
WHERE
257258
id= $1;
258259

‎coderd/unhanger/detector.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,21 @@ func unhangJob(ctx context.Context, log slog.Logger, db database.Store, pub pubs
295295
}
296296
lowestLogID=newLogs[0].ID
297297

298-
// Mark the job as failed.
299298
now=dbtime.Now()
299+
// If we are unhanging a job that was never picked up by the
300+
// provisioner, we need to set the started_at time to the current
301+
// time so that the build duration is correct.
302+
if!job.StartedAt.Valid {
303+
job.StartedAt= sql.NullTime{
304+
Time:now,
305+
Valid:true,
306+
}
307+
}
308+
// Mark the job as failed.
300309
err=db.UpdateProvisionerJobWithCompleteByID(ctx, database.UpdateProvisionerJobWithCompleteByIDParams{
301310
ID:job.ID,
302311
UpdatedAt:now,
312+
StartedAt:job.StartedAt,
303313
CompletedAt: sql.NullTime{
304314
Time:now,
305315
Valid:true,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp