@@ -122,10 +122,7 @@ def tool_deploy(self, message):
122
122
log .error (err )
123
123
return
124
124
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 )
129
126
130
127
if status == TOOL_DEPLOY_FAILED :
131
128
log .error (f"Failed deploying { tool .name } for { user } " )
@@ -144,18 +141,14 @@ def tool_restart(self, message):
144
141
deployment = ToolDeployment (tool , user )
145
142
deployment .restart ()
146
143
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 )
151
145
152
146
if status == TOOL_DEPLOY_FAILED :
153
147
log .error (f"Failed restarting { tool .name } for { user } " )
154
148
else :
155
149
log .debug (f"Restarted { tool .name } for { user } " )
156
150
157
151
158
-
159
152
def send_sse (user_id , event ):
160
153
"""
161
154
Tell the SSEConsumer to send an event to the specified user
@@ -193,8 +186,8 @@ def start_background_task(task, message):
193
186
def wait_for_deployment (user , tool , deployment ):
194
187
while True :
195
188
status = deployment .status
196
- if status in (TOOL_DEPLOY_FAILED , TOOL_READY ):
197
- break
198
189
update_tool_status (user , tool , status )
190
+ if status in (TOOL_DEPLOY_FAILED , TOOL_READY ):
191
+ return status
199
192
sleep (1 )
200
193
0 commit comments