Skip to content

Commit

Permalink
func: remove all modifications to the dispatch function
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanadelacuesta committed Mar 21, 2023
1 parent e4cb7db commit 8920548
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nomad/periodic.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ func (p *PeriodicDispatch) run(ctx context.Context, updateCh <-chan struct{}) {
// based on the passed launch time.
func (p *PeriodicDispatch) dispatch(job *structs.Job, launchTime time.Time) {
p.l.Lock()
defer p.l.Unlock()

nextLaunch, err := job.Periodic.Next(launchTime)
if err != nil {
Expand All @@ -366,16 +365,19 @@ func (p *PeriodicDispatch) dispatch(job *structs.Job, launchTime time.Time) {
running, err := p.dispatcher.RunningChildren(job)
if err != nil {
p.logger.Error("failed to determine if periodic job has running children", "job", job.NamespacedID(), "error", err)
p.l.Unlock()
return
}

if running {
p.logger.Debug("skipping launch of periodic job because job prohibits overlap", "job", job.NamespacedID())
p.l.Unlock()
return
}
}

p.logger.Debug(" launching job", "job", job.NamespacedID(), "launch_time", launchTime)
p.l.Unlock()
p.createEval(job, launchTime)
}

Expand Down

0 comments on commit 8920548

Please sign in to comment.