Skip to content

Commit 11eca65

Browse files
committed
some final renames
1 parent 31c6ddb commit 11eca65

File tree

23 files changed

+360
-357
lines changed

23 files changed

+360
-357
lines changed

cli/testdata/coder_list_--output_json.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"ttl_ms": 28800000,
5353
"last_used_at": "[timestamp]",
5454
"deleting_at": null,
55-
"locked_at": null,
55+
"dormant_at": null,
5656
"health": {
5757
"healthy": true,
5858
"failing_agents": []

coderd/apidoc/docs.go

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

coderd/apidoc/swagger.json

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

coderd/autobuild/lifecycle_executor.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (e *Executor) runOnce(t time.Time) Stats {
175175
}
176176
}
177177

178-
// Lock the workspace if it has breached the template's
178+
// Transition the workspace to dormant if it has breached the template's
179179
// threshold for inactivity.
180180
if reason == database.BuildReasonAutolock {
181181
ws, err = tx.UpdateWorkspaceDormantDeletingAt(e.ctx, database.UpdateWorkspaceDormantDeletingAtParams{
@@ -186,24 +186,24 @@ func (e *Executor) runOnce(t time.Time) Stats {
186186
},
187187
})
188188
if err != nil {
189-
log.Error(e.ctx, "unable to lock workspace",
189+
log.Error(e.ctx, "unable to transition workspace to dormant",
190190
slog.F("transition", nextTransition),
191191
slog.Error(err),
192192
)
193193
return nil
194194
}
195195

196-
log.Info(e.ctx, "locked workspace",
196+
log.Info(e.ctx, "dormant workspace",
197197
slog.F("last_used_at", ws.LastUsedAt),
198-
slog.F("inactivity_ttl", templateSchedule.TimeTilDormant),
198+
slog.F("time_til_dormant", templateSchedule.TimeTilDormant),
199199
slog.F("since_last_used_at", time.Since(ws.LastUsedAt)),
200200
)
201201
}
202202

203203
if reason == database.BuildReasonAutodelete {
204204
log.Info(e.ctx, "deleted workspace",
205205
slog.F("dormant_at", ws.DormantAt.Time),
206-
slog.F("locked_ttl", templateSchedule.TimeTilDormantAutoDelete),
206+
slog.F("time_til_dormant_autodelete", templateSchedule.TimeTilDormantAutoDelete),
207207
)
208208
}
209209

@@ -246,7 +246,7 @@ func (e *Executor) runOnce(t time.Time) Stats {
246246
// for this function to return a nil error as well as an empty transition.
247247
// In such cases it means no provisioning should occur but the workspace
248248
// may be "transitioning" to a new state (such as an inactive, stopped
249-
// workspace transitioning to the locked state).
249+
// workspace transitioning to the dormant state).
250250
func getNextTransition(
251251
ws database.Workspace,
252252
latestBuild database.WorkspaceBuild,
@@ -265,13 +265,13 @@ func getNextTransition(
265265
return database.WorkspaceTransitionStart, database.BuildReasonAutostart, nil
266266
case isEligibleForFailedStop(latestBuild, latestJob, templateSchedule, currentTick):
267267
return database.WorkspaceTransitionStop, database.BuildReasonAutostop, nil
268-
case isEligibleForLockedStop(ws, templateSchedule, currentTick):
268+
case isEligibleForDormantStop(ws, templateSchedule, currentTick):
269269
// Only stop started workspaces.
270270
if latestBuild.Transition == database.WorkspaceTransitionStart {
271271
return database.WorkspaceTransitionStop, database.BuildReasonAutolock, nil
272272
}
273273
// We shouldn't transition the workspace but we should still
274-
// lock it.
274+
// make it dormant.
275275
return "", database.BuildReasonAutolock, nil
276276

277277
case isEligibleForDelete(ws, templateSchedule, currentTick):
@@ -288,7 +288,7 @@ func isEligibleForAutostart(ws database.Workspace, build database.WorkspaceBuild
288288
return false
289289
}
290290

291-
// If the workspace is locked we should not autostart it.
291+
// If the workspace is dormant we should not autostart it.
292292
if ws.DormantAt.Valid {
293293
return false
294294
}
@@ -322,7 +322,7 @@ func isEligibleForAutostop(ws database.Workspace, build database.WorkspaceBuild,
322322
return false
323323
}
324324

325-
// If the workspace is locked we should not autostop it.
325+
// If the workspace is dormant we should not autostop it.
326326
if ws.DormantAt.Valid {
327327
return false
328328
}
@@ -334,23 +334,23 @@ func isEligibleForAutostop(ws database.Workspace, build database.WorkspaceBuild,
334334
!currentTick.Before(build.Deadline)
335335
}
336336

337-
// isEligibleForLockedStop returns true if the workspace should be locked
337+
// isEligibleForDormantStop returns true if the workspace should be dormant
338338
// for breaching the inactivity threshold of the template.
339-
func isEligibleForLockedStop(ws database.Workspace, templateSchedule schedule.TemplateScheduleOptions, currentTick time.Time) bool {
340-
// Only attempt to lock workspaces not already locked.
339+
func isEligibleForDormantStop(ws database.Workspace, templateSchedule schedule.TemplateScheduleOptions, currentTick time.Time) bool {
340+
// Only attempt against workspaces not already dormant.
341341
return !ws.DormantAt.Valid &&
342-
// The template must specify an inactivity TTL.
342+
// The template must specify an time_til_dormant value.
343343
templateSchedule.TimeTilDormant > 0 &&
344-
// The workspace must breach the inactivity TTL.
344+
// The workspace must breach the time_til_dormant value.
345345
currentTick.Sub(ws.LastUsedAt) > templateSchedule.TimeTilDormant
346346
}
347347

348348
func isEligibleForDelete(ws database.Workspace, templateSchedule schedule.TemplateScheduleOptions, currentTick time.Time) bool {
349-
// Only attempt to delete locked workspaces.
349+
// Only attempt to delete dormant workspaces.
350350
return ws.DormantAt.Valid && ws.DeletingAt.Valid &&
351-
// Locked workspaces should only be deleted if a locked_ttl is specified.
351+
// Dormant workspaces should only be deleted if a time_til_dormant_autodelete value is specified.
352352
templateSchedule.TimeTilDormantAutoDelete > 0 &&
353-
// The workspace must breach the locked_ttl.
353+
// The workspace must breach the time_til_dormant_autodelete value.
354354
currentTick.After(ws.DeletingAt.Time)
355355
}
356356

coderd/coderd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ func New(options *Options) *API {
854854
})
855855
r.Get("/watch", api.watchWorkspace)
856856
r.Put("/extend", api.putExtendWorkspace)
857-
r.Put("/lock", api.putWorkspaceLock)
857+
r.Put("/dormant", api.putWorkspaceDormant)
858858
})
859859
})
860860
r.Route("/workspacebuilds/{workspacebuild}", func(r chi.Router) {

coderd/database/queries.sql.go

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

0 commit comments

Comments
 (0)