Skip to content

Commit ded669b

Browse files
committed
update comment with more info
1 parent f594abb commit ded669b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

coderd/autobuild/executor/lifecycle_executor.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,18 @@ func (e *Executor) Run() {
5050
func (e *Executor) runOnce(t time.Time) error {
5151
currentTick := t.Truncate(time.Minute)
5252
return e.db.InTx(func(db database.Store) error {
53-
// XXX: if a workspace build is created when ttl != null and then ttl is unset,
54-
// autostop will still happen for this workspace build. Whether this is
55-
// expected behavior from a user's perspective is not yet known.
53+
// TTL is set at the workspace level, and deadline at the workspace build level.
54+
// When a workspace build is created, its deadline initially starts at zero.
55+
// When provisionerd successfully completes a provision job, the deadline is
56+
// set to now + TTL if the associated workspace has a TTL set. This deadline
57+
// is what we compare against when performing autostop operations, rounded down
58+
// to the minute.
59+
//
60+
// NOTE: Currently, if a workspace build is created with a given TTL and then
61+
// the user either changes or unsets the TTL, the deadline for the workspace
62+
// build will not have changed. So, autostop will still happen at the
63+
// original TTL value from when the workspace build was created.
64+
// Whether this is expected behavior from a user's perspective is not yet known.
5665
eligibleWorkspaces, err := db.GetWorkspacesAutostart(e.ctx)
5766
if err != nil {
5867
return xerrors.Errorf("get eligible workspaces for autostart or autostop: %w", err)

0 commit comments

Comments
 (0)