Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temporarily allow H and ~ for hash schedule (to migrate jobs) #45

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dkron/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func (j *Job) nameHash() int {
func (j *Job) scheduleHash() string {
spec := j.Schedule

if !strings.Contains(spec, HashSymbol) {
if !strings.Contains(spec, HashSymbol) && !strings.Contains(spec, "H") {
return spec
}

Expand All @@ -339,7 +339,7 @@ func (j *Job) scheduleHash() string {
continue
}

if strings.Contains(part, HashSymbol) {
if strings.Contains(part, HashSymbol) || strings.Contains(part, "H") {
// mods taken in accordance with https://dkron.io/docs/usage/cron-spec/#cron-expression-format
partHash := hash
switch partIndex {
Expand All @@ -355,6 +355,7 @@ func (j *Job) scheduleHash() string {
partHash %= 60
}
parts[index] = strings.ReplaceAll(part, HashSymbol, strconv.Itoa(partHash))
parts[index] = strings.ReplaceAll(part, "H", strconv.Itoa(partHash))
}

partIndex++
Expand Down
Loading