Skip to content

feat!: bump workspace activity by 1 hour #10704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Nov 15, 2023
Merged
Prev Previous commit
Next Next commit
Add comment
  • Loading branch information
Emyrk committed Nov 15, 2023
commit dc84fb89d2480664259a559bfe09c87c39c0018a
1 change: 0 additions & 1 deletion coderd/activitybump_internal_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package coderd

import (
"context"
"database/sql"
"testing"
"time"
Expand Down
2 changes: 1 addition & 1 deletion coderd/database/dbmem/dbmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ func (q *FakeQuerier) ActivityBumpWorkspace(ctx context.Context, arg database.Ac
if now.Add(time.Hour).After(arg.NextAutostart) && arg.NextAutostart.After(now) {
// Extend to TTL
add := arg.NextAutostart.Sub(now)
if workspace.Ttl.Valid {
if workspace.Ttl.Valid && template.AllowUserAutostop {
add += time.Duration(workspace.Ttl.Int64)
} else {
add += time.Duration(template.DefaultTTL)
Expand Down
6 changes: 6 additions & 0 deletions coderd/database/querier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions coderd/database/queries/activitybump.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-- Bumps the workspace deadline by 1 hour. If the workspace bump will
-- cross an autostart threshold, then the bump is autostart + TTL. This
-- is the deadline behavior if the workspace was to autostart from a stopped
-- state.
-- Max deadline is respected, and will never be bumped.
-- The deadline will never decrease.
-- name: ActivityBumpWorkspace :exec
WITH latest AS (
SELECT
Expand Down