From cb92f1794a3826b6ba3d3fa52fb07937fd13279c Mon Sep 17 00:00:00 2001 From: mabashian Date: Fri, 6 Apr 2018 10:15:24 -0400 Subject: [PATCH] Handle race condition where workflow job status might appear stuck in waiting if we miss the socket event indicating that it got moved to running --- .../workflow-results/workflow-results.controller.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/awx/ui/client/src/workflow-results/workflow-results.controller.js b/awx/ui/client/src/workflow-results/workflow-results.controller.js index be5d26e928..85112cddd8 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.controller.js +++ b/awx/ui/client/src/workflow-results/workflow-results.controller.js @@ -195,6 +195,16 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions', if(data.hasOwnProperty('workflow_job_id') && parseInt(data.workflow_job_id, 10) === parseInt($scope.workflow.id,10)){ + // This check ensures that the workflow status icon doesn't get stuck in + // the waiting state due to the UI missing the initial socket message. This + // can happen if the GET request on the workflow job returns "waiting" and + // the sockets aren't established yet so we miss the event that indicates + // the workflow job has moved into a running state. + if (!_.includes(['running', 'successful', 'failed', 'error'], $scope.workflow.status)){ + $scope.workflow.status = 'running'; + runTimeElapsedTimer = workflowResultsService.createOneSecondTimer(moment(), updateWorkflowJobElapsedTimer); + } + WorkflowService.updateStatusOfNode({ treeData: $scope.treeData, nodeId: data.workflow_node_id,