From 818edf544839e3e172062e388f12596da62f20ea Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Mon, 14 Jul 2025 16:36:46 -0700 Subject: [PATCH] core: remove dead code hasAlloc was only ever false, so it could never trigger JobStatusDead --- nomad/state/state_store.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nomad/state/state_store.go b/nomad/state/state_store.go index 2b5a005d5e1..953fc59679f 100644 --- a/nomad/state/state_store.go +++ b/nomad/state/state_store.go @@ -5492,7 +5492,6 @@ func (s *StateStore) getJobStatus(txn *txn, job *structs.Job, evalDelete bool) ( } // If there is a non-terminal allocation, the job is running. - hasAlloc := false for alloc := allocs.Next(); alloc != nil; alloc = allocs.Next() { if !alloc.(*structs.Allocation).TerminalStatus() { return structs.JobStatusRunning, nil @@ -5515,7 +5514,7 @@ func (s *StateStore) getJobStatus(txn *txn, job *structs.Job, evalDelete bool) ( // The job is dead if all allocations for this version are terminal, // all evals are terminal. In the event a jobs allocs and evals // are all GC'd, we don't want the job to be marked pending. - if evalDelete || hasEval || hasAlloc || job.Stop { + if evalDelete || hasEval || job.Stop { return structs.JobStatusDead, nil }