From 4a247e9110a3c9fc7398acd3bcdeb4d9d7d321fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Tich=C3=A1k?= Date: Tue, 13 Oct 2026 14:21:12 +0200 Subject: [PATCH] [core] fix lost ACTIVE status notification during deploy --- core/environment/transition_deploy.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/environment/transition_deploy.go b/core/environment/transition_deploy.go index 9c0e49b5b..28e938dd7 100644 --- a/core/environment/transition_deploy.go +++ b/core/environment/transition_deploy.go @@ -184,9 +184,13 @@ func (t DeployTransition) do(env *Environment) (err error) { return*/ - notifyStatus := make(chan task.Status) + // notifyStatusCh is used only as a wake-up signal. To be sure that updates are not missed we need to + // query the status wia wf.GetStatus() because senders is sending asynchronously so the value + // inside the channel does not have to be the most recent. I didn't change the channel type to + // not break something else. + notifyStatusCh := make(chan task.Status, 1) subscriptionId := uuid.NewUUID().String() - env.wfAdapter.SubscribeToStatusChange(subscriptionId, notifyStatus) + env.wfAdapter.SubscribeToStatusChange(subscriptionId, notifyStatusCh) defer env.wfAdapter.UnsubscribeFromStatusChange(subscriptionId) // listen to workflow State changes @@ -230,7 +234,8 @@ func (t DeployTransition) do(env *Environment) (err error) { WORKFLOW_ACTIVE_LOOP: for { select { - case wfStatus = <-notifyStatus: + case <-notifyStatusCh: + wfStatus = wf.GetStatus() log.WithField("status", wfStatus.String()). WithField("partition", env.Id().String()). Debug("workflow status change") @@ -268,6 +273,10 @@ func (t DeployTransition) do(env *Environment) (err error) { case <-time.After(deploymentTimeout): wfStatus = wf.GetStatus() + // just a safety check in case we missed the final update + if wfStatus == task.ACTIVE { + break WORKFLOW_ACTIVE_LOOP + } inactiveTaskRoles := make([]string, 0) undeployableTaskRoles := make([]string, 0) workflow.LeafWalk(wf, func(role workflow.Role) {