From 188c64b43a612ac0dc5b0a99f38f78e9a5010dff Mon Sep 17 00:00:00 2001 From: Drew Bailey Date: Fri, 8 Jan 2021 11:49:29 -0500 Subject: [PATCH] Prevent Job Statuses from being calculated twice https://github.com/hashicorp/nomad/pull/8435 introduced atomic eval insertion iwth job (de-)registration. This change removes a now obsolete guard which checked if the index was equal to the job.CreateIndex, which would empty the status. Now that the job regisration eval insetion is atomic with the registration this check is no longer necessary to set the job statuses correctly. --- nomad/state/state_store.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/nomad/state/state_store.go b/nomad/state/state_store.go index 1c749827327..51271cc31ca 100644 --- a/nomad/state/state_store.go +++ b/nomad/state/state_store.go @@ -4427,9 +4427,6 @@ func (s *StateStore) setJobStatus(index uint64, txn *txn, // Capture the current status so we can check if there is a change oldStatus := job.Status - if index == job.CreateIndex { - oldStatus = "" - } newStatus := forceStatus // If forceStatus is not set, compute the jobs status.