mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
Deregister garbage collected jobs
This commit is contained in:
@@ -189,12 +189,19 @@ func (w *drainingJobWatcher) watch() {
|
||||
w.logger.Printf("[TRACE] nomad.drain.job_watcher: handling job %v", jns)
|
||||
|
||||
// Lookup the job
|
||||
job, err := w.state.JobByID(nil, jns.Namespace, jns.ID)
|
||||
if err != nil || job == nil {
|
||||
job, err := snap.JobByID(nil, jns.Namespace, jns.ID)
|
||||
if err != nil {
|
||||
w.logger.Printf("[WARN] nomad.drain.job_watcher: failed to lookup job %v: %v", jns, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Ignore purged jobs
|
||||
if job == nil {
|
||||
w.logger.Printf("[TRACE] nomad.drain.job_watcher: ignoring garbage collected job %q", jns)
|
||||
w.deregisterJob(jns.ID, jns.Namespace)
|
||||
continue
|
||||
}
|
||||
|
||||
// Ignore all non-service jobs
|
||||
if job.Type != structs.JobTypeService {
|
||||
w.deregisterJob(job.ID, job.Namespace)
|
||||
|
||||
Reference in New Issue
Block a user