mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add template max_ttl (#6114)
Co-authored-by: Bruno Quaresma <bruno@coder.com>
This commit is contained in:
co-authored by
Bruno Quaresma
parent
248c53d68d
commit
66a6b590a1
@@ -316,3 +316,17 @@ SET
|
||||
last_used_at = $2
|
||||
WHERE
|
||||
id = $1;
|
||||
|
||||
-- name: UpdateWorkspaceTTLToBeWithinTemplateMax :exec
|
||||
UPDATE
|
||||
workspaces
|
||||
SET
|
||||
ttl = LEAST(ttl, @template_max_ttl::bigint)
|
||||
WHERE
|
||||
template_id = @template_id
|
||||
-- LEAST() does not pick NULL, so filter it out as we don't want to set a
|
||||
-- TTL on the workspace if it's unset.
|
||||
--
|
||||
-- During build time, the template max TTL will still be used if the
|
||||
-- workspace TTL is NULL.
|
||||
AND ttl IS NOT NULL;
|
||||
|
||||
Reference in New Issue
Block a user