Skip to content

Commit dc37bf9

Browse files
committed
address PR comments
1 parent 50f7578 commit dc37bf9

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

coderd/database/querier.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/activitybump.sql

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
-- We bump by the original TTL to prevent counter-intuitive behavior
22
-- as the TTL wraps. For example, if I set the TTL to 12 hours, sign off
33
-- work at midnight, come back at 10am, I would want another full day
4-
-- of uptime. In the prior implementation, the workspace would enter
5-
-- a state of always expiring 1 hour in the future.
4+
-- of uptime.
65
-- name: ActivityBumpWorkspace :exec
76
WITH latest AS (
87
SELECT
@@ -11,8 +10,7 @@ WITH latest AS (
1110
workspace_builds.max_deadline::timestamp AS build_max_deadline,
1211
workspace_builds.transition AS build_transition,
1312
provisioner_jobs.completed_at::timestamp AS job_completed_at,
14-
(workspaces.ttl / 1000 / 1000 / 1000 || ' seconds')::interval AS ttl_interval,
15-
(NOW() AT TIME ZONE 'UTC')::timestamp as now_utc
13+
(workspaces.ttl / 1000 / 1000 / 1000 || ' seconds')::interval AS ttl_interval
1614
FROM workspace_builds
1715
JOIN provisioner_jobs
1816
ON provisioner_jobs.id = workspace_builds.job_id
@@ -28,8 +26,8 @@ SET
2826
updated_at = NOW(),
2927
deadline = CASE
3028
WHEN l.build_max_deadline = '0001-01-01 00:00:00'
31-
THEN l.now_utc + l.ttl_interval
32-
ELSE LEAST(l.now_utc + l.ttl_interval, l.build_max_deadline)
29+
THEN NOW() + l.ttl_interval
30+
ELSE LEAST(NOW() + l.ttl_interval, l.build_max_deadline)
3331
END
3432
FROM latest l
3533
WHERE wb.id = l.build_id

0 commit comments

Comments
 (0)