Skip to content

Commit 94872aa

Browse files
committed
function name remove Schedule
1 parent a6b5a0b commit 94872aa

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

coderd/agentapi/stats.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (a *StatsAPI) UpdateStats(ctx context.Context, req *agentproto.UpdateStatsR
8383
slog.Error(err),
8484
)
8585
} else {
86-
next, allowed := schedule.NextAutostartSchedule(now, workspace.AutostartSchedule.String, templateSchedule)
86+
next, allowed := schedule.NextAutostart(now, workspace.AutostartSchedule.String, templateSchedule)
8787
if allowed {
8888
nextAutostart = next
8989
}

coderd/autobuild/lifecycle_executor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ func isEligibleForAutostart(user database.User, ws database.Workspace, build dat
367367
return false
368368
}
369369

370-
nextTransition, allowed := schedule.NextAutostartSchedule(build.CreatedAt, ws.AutostartSchedule.String, templateSchedule)
370+
nextTransition, allowed := schedule.NextAutostart(build.CreatedAt, ws.AutostartSchedule.String, templateSchedule)
371371
if !allowed {
372372
return false
373373
}

coderd/schedule/autostart.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import (
66
"github.com/coder/coder/v2/coderd/schedule/cron"
77
)
88

9-
// NextAutostartSchedule takes the workspace and template schedule and returns the next autostart schedule
9+
// NextAutostart takes the workspace and template schedule and returns the next autostart schedule
1010
// after "at". The boolean returned is if the autostart should be allowed to start based on the template
1111
// schedule.
12-
func NextAutostartSchedule(at time.Time, wsSchedule string, templateSchedule TemplateScheduleOptions) (time.Time, bool) {
12+
func NextAutostart(at time.Time, wsSchedule string, templateSchedule TemplateScheduleOptions) (time.Time, bool) {
1313
sched, err := cron.Weekly(wsSchedule)
1414
if err != nil {
1515
return time.Time{}, false

coderd/schedule/autostop.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type CalculateAutostopParams struct {
4747
// WorkspaceAutostart can be the empty string if no workspace autostart
4848
// is configured.
4949
// If configured, this is expected to be a cron weekly event parsable
50-
// by autobuild.NextAutostartSchedule
50+
// by autobuild.NextAutostart
5151
WorkspaceAutostart string
5252

5353
Now time.Time
@@ -137,7 +137,7 @@ func CalculateAutostop(ctx context.Context, params CalculateAutostopParams) (Aut
137137
// 3. User starts workspace at 9:45pm.
138138
// - The initial deadline is calculated to be 9:45am
139139
// - This crosses the autostart deadline, so the deadline is extended to 9pm
140-
nextAutostart, ok := NextAutostartSchedule(params.Now, params.WorkspaceAutostart, templateSchedule)
140+
nextAutostart, ok := NextAutostart(params.Now, params.WorkspaceAutostart, templateSchedule)
141141
if ok && autostop.Deadline.After(nextAutostart) {
142142
autostop.Deadline = nextAutostart.Add(ttl)
143143
}

coderd/workspaceagents.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
11861186
slog.Error(err),
11871187
)
11881188
} else {
1189-
next, allowed := schedule.NextAutostartSchedule(time.Now(), workspace.AutostartSchedule.String, templateSchedule)
1189+
next, allowed := schedule.NextAutostart(time.Now(), workspace.AutostartSchedule.String, templateSchedule)
11901190
if allowed {
11911191
nextAutostart = next
11921192
}

0 commit comments

Comments
 (0)