mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
refactor(coderd/schedule): move cron schedule to cron package (#9507)
This removes an indirect import of `coderd/database` from the CLI and results in a logical separation between server related and generalized schedule. No size change (yet). Ref: #9380
This commit is contained in:
committed by
GitHub
parent
c31292abe8
commit
ad23d33f28
@ -8,7 +8,7 @@ import (
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/schedule"
|
||||
"github.com/coder/coder/v2/coderd/schedule/cron"
|
||||
"github.com/coder/coder/v2/coderd/util/tz"
|
||||
)
|
||||
|
||||
@ -74,7 +74,7 @@ func relative(d time.Duration) string {
|
||||
}
|
||||
|
||||
// parseCLISchedule parses a schedule in the format HH:MM{AM|PM} [DOW] [LOCATION]
|
||||
func parseCLISchedule(parts ...string) (*schedule.Schedule, error) {
|
||||
func parseCLISchedule(parts ...string) (*cron.Schedule, error) {
|
||||
// If the user was careful and quoted the schedule, un-quote it.
|
||||
// In the case that only time was specified, this will be a no-op.
|
||||
if len(parts) == 1 {
|
||||
@ -121,7 +121,7 @@ func parseCLISchedule(parts ...string) (*schedule.Schedule, error) {
|
||||
}
|
||||
}
|
||||
|
||||
sched, err := schedule.Weekly(fmt.Sprintf(
|
||||
sched, err := cron.Weekly(fmt.Sprintf(
|
||||
"CRON_TZ=%s %d %d * * %s",
|
||||
loc.String(),
|
||||
minute,
|
||||
|
Reference in New Issue
Block a user