mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add API/SDK support for autostop extension (#1778)
* Adds deadline column to workspace_builds, associated DB/API plumbing * database: Upon inserting a row into workspace_builds, deadline will initially be zero. * autobuild: Executor now checks the Deadline field of the workspace_build for the purpose of autostop logic. * coderd: Adds a new route /api/v2/workspaces/:workspace/extend which allows updating the deadline of the currently active workspace build. The new deadline must be after the existing deadline, and not the zero time. * provisionerd: updates workspace_build.deadline upon successful workspace build completion (equal to now plus workspace TTL, if it exists).
This commit is contained in:
@@ -101,16 +101,18 @@ INSERT INTO
|
||||
transition,
|
||||
initiator_id,
|
||||
job_id,
|
||||
provisioner_state
|
||||
provisioner_state,
|
||||
deadline
|
||||
)
|
||||
VALUES
|
||||
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING *;
|
||||
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING *;
|
||||
|
||||
-- name: UpdateWorkspaceBuildByID :exec
|
||||
UPDATE
|
||||
workspace_builds
|
||||
SET
|
||||
updated_at = $2,
|
||||
provisioner_state = $3
|
||||
provisioner_state = $3,
|
||||
deadline = $4
|
||||
WHERE
|
||||
id = $1;
|
||||
|
||||
Reference in New Issue
Block a user