From b2330707738141e3189ff13dd6039fdf9d56c6fa Mon Sep 17 00:00:00 2001 From: Paolo Chila Date: Mon, 2 Oct 2023 15:54:17 +0200 Subject: [PATCH] use shuttingDown atomic bool instead of component state --- pkg/component/runtime/manager.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/component/runtime/manager.go b/pkg/component/runtime/manager.go index 0faa30e1dae..5fd7dd51df0 100644 --- a/pkg/component/runtime/manager.go +++ b/pkg/component/runtime/manager.go @@ -705,8 +705,8 @@ func (m *Manager) update(model component.Model, teardown bool) error { var stoppedWg sync.WaitGroup stoppedWg.Add(len(stop)) for _, existing := range stop { - if existing.getLatest().State == client.UnitStateStopped { - // it's already stopped, move on + if existing.shuttingDown.Load() { + // it's already shutting down, move on stoppedWg.Done() continue }