Skip to content

Commit 0172c5b

Browse files
fix: pass currentTick to GetWorkspacesEligibleForTransition
1 parent a982168 commit 0172c5b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

coderd/autobuild/lifecycle_executor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (e *Executor) runOnce(t time.Time) Stats {
142142
// NOTE: If a workspace build is created with a given TTL and then the user either
143143
// changes or unsets the TTL, the deadline for the workspace build will not
144144
// have changed. This behavior is as expected per #2229.
145-
workspaces, err := e.db.GetWorkspacesEligibleForTransition(e.ctx, t)
145+
workspaces, err := e.db.GetWorkspacesEligibleForTransition(e.ctx, currentTick)
146146
if err != nil {
147147
e.log.Error(e.ctx, "get workspaces for autostart or autostop", slog.Error(err))
148148
return stats

coderd/database/dbmem/dbmem.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6955,8 +6955,7 @@ func (q *FakeQuerier) GetWorkspacesEligibleForTransition(ctx context.Context, no
69556955
build.Transition == database.WorkspaceTransitionStop &&
69566956
workspace.AutostartSchedule.Valid &&
69576957
(workspace.NextStartAt.Time.IsZero() ||
6958-
now.After(workspace.NextStartAt.Time) ||
6959-
now.Equal(workspace.NextStartAt.Time)) {
6958+
!now.Before(workspace.NextStartAt.Time)) {
69606959
workspaces = append(workspaces, database.GetWorkspacesEligibleForTransitionRow{
69616960
ID: workspace.ID,
69626961
Name: workspace.Name,

0 commit comments

Comments
 (0)