MCPcopy Index your code
hub / github.com/coder/coder / isEligibleForDormantStop

Function isEligibleForDormantStop

coderd/autobuild/lifecycle_executor.go:648–655  ·  view source on GitHub ↗

isEligibleForDormantStop returns true if the workspace should be dormant for breaching the inactivity threshold of the template.

(ws database.Workspace, templateSchedule schedule.TemplateScheduleOptions, currentTick time.Time)

Source from the content-addressed store, hash-verified

646// isEligibleForDormantStop returns true if the workspace should be dormant
647// for breaching the inactivity threshold of the template.
648func isEligibleForDormantStop(ws database.Workspace, templateSchedule schedule.TemplateScheduleOptions, currentTick time.Time) bool {
649 // Only attempt against workspaces not already dormant.
650 return !ws.DormantAt.Valid &&
651 // The template must specify an time_til_dormant value.
652 templateSchedule.TimeTilDormant > 0 &&
653 // The workspace must breach the time_til_dormant value.
654 currentTick.Sub(ws.LastUsedAt) > templateSchedule.TimeTilDormant
655}
656
657func isEligibleForDelete(ws database.Workspace, templateSchedule schedule.TemplateScheduleOptions, lastBuild database.WorkspaceBuild, lastJob database.ProvisionerJob, currentTick time.Time) bool {
658 eligible := ws.DormantAt.Valid && ws.DeletingAt.Valid &&

Callers 1

getNextTransitionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected