Some cron implementations use H as a hashed substitution for a value:
'H' is used in the Jenkins continuous integration system to indicate that a "hashed" value is substituted. Thus instead of a fixed number such as '20 ' which means at 20 minutes after the hour every hour, 'H ' indicates that the task is performed every hour at an unspecified but invariant time for each task. This allows spreading out tasks over time, rather than having all of them start at the same time and compete for resources.
This change extends the API without breaking backward compatibility by adding a ParseWithJobName function allowing the caller to provide a unique job name to perform the hashing.
The function supports the following expressions:
H: Uses the provided bounds as min/max with step of 1
H/n: Uses the provided bounds as min/max with step of n
H(min-max): Uses the specified range with step of 1
H(min-max)/n: Uses the specified range with step of n
parser := NewParser(SecondOptional | Minute | Hour | Dom | Month | Dow | Descriptor)
parser.ParseWithJobName("H(0-30)/10 * * * * *", "job2")
// results in a schedule that runs every minute at the 8, 18, 28 second mark.
This implements what is requested in #309
Some cron implementations use H as a hashed substitution for a value:
This change extends the API without breaking backward compatibility by adding a
ParseWithJobName
function allowing the caller to provide a unique job name to perform the hashing.The function supports the following expressions:
H
: Uses the provided bounds as min/max with step of 1H/n
: Uses the provided bounds as min/max with step of nH(min-max)
: Uses the specified range with step of 1H(min-max)/n
: Uses the specified range with step of n