Skip to content

Commit

Permalink
remove temporary support for H as hash symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
fopina committed Sep 16, 2024
1 parent 9087dc3 commit 0b50aff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dkron/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,12 @@ func (j *Job) nameHash() int {
return hash
}

// scheduleHash replaces H in the cron spec by a value derived from job Name
// scheduleHash replaces hash symbol in the cron spec by a value derived from job Name
// such as "0 0 ~ * * *"
func (j *Job) scheduleHash() string {
spec := j.Schedule

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

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

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

partIndex++
Expand Down

0 comments on commit 0b50aff

Please sign in to comment.