From fc30fe35486154cfa8352d306973cb6d67401a6c Mon Sep 17 00:00:00 2001 From: Andy Driver Date: Wed, 13 Nov 2019 14:06:39 +0000 Subject: [PATCH] Avoid infinite loop waiting for Tool deployment (#776) Break out of the wait loop if the deployment status is anything other than TOOL_DEPLOYING - this may result in some deployments being reported as failed incorrectly, but should avoid the consumer getting stuck. --- controlpanel/frontend/consumers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controlpanel/frontend/consumers.py b/controlpanel/frontend/consumers.py index c7d2eb7d9..e663003ff 100644 --- a/controlpanel/frontend/consumers.py +++ b/controlpanel/frontend/consumers.py @@ -200,10 +200,10 @@ def start_background_task(task, message): ) def wait_for_deployment(deployment, id_token): - while True: + status = TOOL_DEPLOYING + while status == TOOL_DEPLOYING: status = deployment.get_status(id_token) update_tool_status(deployment.user, deployment.tool, status) - if status in (TOOL_DEPLOY_FAILED, TOOL_READY, TOOL_IDLED): - return status sleep(1) + return status