cmd/jobrun: repeat strategies as part of jobrun

This commit is contained in:
Christian Schwarz
2017-06-09 21:00:28 +02:00
parent 93d098162e
commit af2aa9dfe1
5 changed files with 96 additions and 23 deletions

View File

@ -158,9 +158,8 @@ func cmdRun(c *cli.Context) error {
i := 0
for _, pull := range conf.Pulls {
jobs[i] = jobrun.Job{
Name: fmt.Sprintf("pull%d", i),
Interval: time.Duration(5 * time.Second),
Repeats: true,
Name: fmt.Sprintf("pull.%d", i),
RepeatStrategy: pull.RepeatStrategy,
RunFunc: func(log jobrun.Logger) error {
log.Printf("doing pull: %v", pull)
return jobPull(pull, c, log)
@ -170,9 +169,8 @@ func cmdRun(c *cli.Context) error {
}
for _, push := range conf.Pushs {
jobs[i] = jobrun.Job{
Name: fmt.Sprintf("push%d", i),
Interval: time.Duration(5 * time.Second),
Repeats: true,
Name: fmt.Sprintf("push.%d", i),
RepeatStrategy: push.RepeatStrategy,
RunFunc: func(log jobrun.Logger) error {
log.Printf("doing push: %v", push)
return jobPush(push, c, log)