Skip to content

Commit fe8ad0e

Browse files
committed
Fix READY status reporting
1 parent ab56bf6 commit fe8ad0e

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

controlpanel/frontend/consumers.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,7 @@ def tool_deploy(self, message):
122122
log.error(err)
123123
return
124124

125-
wait_for_deployment(user, tool, deployment)
126-
127-
status = deployment.status
128-
update_tool_status(user, tool, status)
125+
status = wait_for_deployment(user, tool, deployment)
129126

130127
if status == TOOL_DEPLOY_FAILED:
131128
log.error(f"Failed deploying {tool.name} for {user}")
@@ -144,18 +141,14 @@ def tool_restart(self, message):
144141
deployment = ToolDeployment(tool, user)
145142
deployment.restart()
146143

147-
wait_for_deployment(user, tool, deployment)
148-
149-
status = deployment.status
150-
update_tool_status(user, tool, status)
144+
status = wait_for_deployment(user, tool, deployment)
151145

152146
if status == TOOL_DEPLOY_FAILED:
153147
log.error(f"Failed restarting {tool.name} for {user}")
154148
else:
155149
log.debug(f"Restarted {tool.name} for {user}")
156150

157151

158-
159152
def send_sse(user_id, event):
160153
"""
161154
Tell the SSEConsumer to send an event to the specified user
@@ -193,8 +186,8 @@ def start_background_task(task, message):
193186
def wait_for_deployment(user, tool, deployment):
194187
while True:
195188
status = deployment.status
196-
if status in (TOOL_DEPLOY_FAILED, TOOL_READY):
197-
break
198189
update_tool_status(user, tool, status)
190+
if status in (TOOL_DEPLOY_FAILED, TOOL_READY):
191+
return status
199192
sleep(1)
200193

0 commit comments

Comments
 (0)