Skip to content

Commit

Permalink
Pull snapshotting out of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Mar 16, 2018
1 parent 3500ed7 commit 8be12ee
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions nomad/job_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,17 +674,18 @@ func (j *Job) BatchDeregister(args *structs.JobBatchDeregisterRequest, reply *st
}
}

// Grab a snapshot
snap, err := j.srv.fsm.State().Snapshot()
if err != nil {
return err
}

// Loop through to create evals
for jobNS, options := range args.Jobs {
if options == nil {
return fmt.Errorf("no deregister options provided for %v", jobNS)
}

// Lookup the job
snap, err := j.srv.fsm.State().Snapshot()
if err != nil {
return err
}
job, err := snap.JobByID(nil, jobNS.Namespace, jobNS.ID)
if err != nil {
return err
Expand Down

0 comments on commit 8be12ee

Please sign in to comment.