From fb7b2282b1af5895338ae2a4b632c19148d64da8 Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Fri, 24 Jul 2020 05:50:41 -0700 Subject: [PATCH] scheduler: label loops with nested switch statements for effective break (#8528) --- scheduler/annotate.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scheduler/annotate.go b/scheduler/annotate.go index a2509bb73..fb5aef27c 100644 --- a/scheduler/annotate.go +++ b/scheduler/annotate.go @@ -166,26 +166,29 @@ func annotateTask(diff *structs.TaskDiff, parent *structs.TaskGroupDiff) { // All changes to primitive fields result in a destructive update except // KillTimeout destructive := false +FieldsLoop: for _, fDiff := range diff.Fields { switch fDiff.Name { case "KillTimeout": continue default: destructive = true - break + break FieldsLoop } } // Object changes that can be done in-place are log configs, services, // constraints. + if !destructive { + ObjectsLoop: for _, oDiff := range diff.Objects { switch oDiff.Name { case "LogConfig", "Service", "Constraint": continue default: destructive = true - break + break ObjectsLoop } } }