Skip to content

Commit b8ec4fc

Browse files
committed
fixup! feat: add crontab package for supporting autostart/stop. This is basically a small wrapper around robfig/cron/v3.
1 parent 50a9b26 commit b8ec4fc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

coderd/crontab/crontab.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var defaultParser = cron.NewParser(parserFormat)
1717
// local_sched, _ := cron.Parse("59 23 *")
1818
// fmt.Println(sched.Next(time.Now().Format(time.RFC3339)))
1919
// // Output: 2022-04-04T23:59:00Z
20-
// us_sched, _ := cron.Parse("TZ=US/Central 30 9 1-5")
20+
// us_sched, _ := cron.Parse("CRON_TZ=US/Central 30 9 1-5")
2121
// fmt.Println(sched.Next(time.Now()).Format(time.RFC3339))
2222
// // Output: 2022-04-04T14:30:00Z
2323
type WeeklySchedule interface {

coderd/crontab/crontab_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func Test_Parse(t *testing.T) {
1818
}{
1919
{
2020
name: "with timezone",
21-
spec: "TZ=US/Central 30 9 1-5",
21+
spec: "CRON_TZ=US/Central 30 9 1-5",
2222
at: time.Date(2022, 4, 1, 14, 29, 0, 0, time.UTC),
2323
expectedNext: time.Date(2022, 4, 1, 14, 30, 0, 0, time.UTC),
2424
expectedError: "",
@@ -39,7 +39,7 @@ func Test_Parse(t *testing.T) {
3939
},
4040
{
4141
name: "invalid location",
42-
spec: "TZ=Fictional/Country 30 9 1-5",
42+
spec: "CRON_TZ=Fictional/Country 30 9 1-5",
4343
at: time.Time{},
4444
expectedNext: time.Time{},
4545
expectedError: "parse schedule: provided bad location Fictional/Country: unknown time zone Fictional/Country",

0 commit comments

Comments
 (0)