Skip to content

Commit

Permalink
fix: cron generator to support hourly interval
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Dec 19, 2023
1 parent 80e4245 commit a79ad3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/helpers/helpers_cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ func ConvertCrontab(namespace, cron string) (string, error) {
continue
}
}
match3, _ := regexp.MatchString("^(H|\\*)/([0-2]?[0-9])$", val)
match3, _ := regexp.MatchString("^(H|\\*)/([01]?[0-9]|2[0-3])$", val)
if match3 {
// A Minute like H/15 or */15 is defined, create a list of hours with a random start
// An hour like H/15 or */15 is defined, create a list of hours with a random start
// like 1,7,13,19
params := getCaptureBlocks("^(?P<P1>H|\\*)/(?P<P2>[0-2]?[0-9])$", val)
params := getCaptureBlocks("^(?P<P1>H|\\*)/(?P<P2>[01]?[0-9]|2[0-3])$", val)
step, err := strconv.Atoi(params["P2"])
if err != nil {
return "", fmt.Errorf("cron definition '%s' is invalid, unable to determine hours value", cron)
Expand Down

0 comments on commit a79ad3d

Please sign in to comment.