@@ -85,16 +85,16 @@ async def transcoder_put_input_cbor(input_cbor: str):
8585 session .refresh (c1 )
8686 transcoder_log_id = c1 .transcoder_log_id
8787 session .commit ()
88- status = "Submitted ARI to transcoder"
88+ state = "Submitted ARI to transcoder"
8989 else :
9090 # the input_ari has already been submitted
91- status = "ARI previously submitted, check log"
91+ state = "ARI previously submitted, check log"
9292 transcoder_log_id = curr_uri .transcoder_log_id
9393
9494 logger .info ('PUBLISH to transcode/CoreFacing/Outgoing, msg = %s' % msg )
9595 MQTT_CLIENT .publish ("transcode/CoreFacing/Outgoing" , msg )
9696
97- return {"id" : transcoder_log_id , "status" : status }
97+ return {"id" : transcoder_log_id , "status" : state }
9898
9999
100100@router .get ("/ui/incoming/await/{cbor}/hex" , status_code = status .HTTP_200_OK )
@@ -200,16 +200,16 @@ def transcoder_put_str(input_ari: str):
200200 session .refresh (c1 )
201201 transcoder_log_id = c1 .transcoder_log_id
202202 session .commit ()
203- status = "Submitted ARI to transcoder"
203+ state = "Submitted ARI to transcoder"
204204 else :
205205 # the input_ari has already been submitted
206- status = "ARI previously submitted, check log"
206+ state = "ARI previously submitted, check log"
207207 transcoder_log_id = curr_uri .transcoder_log_id
208208
209209 logger .info ('PUBLISH to transcode/CoreFacing/Outgoing, msg = %s' % msg )
210210 MQTT_CLIENT .publish ("transcode/CoreFacing/Outgoing" , msg )
211211
212- return {"id" : transcoder_log_id , "status" : status }
212+ return {"id" : transcoder_log_id , "status" : state }
213213
214214
215215
@@ -223,21 +223,24 @@ async def transcoder_send_ari_str(eid: str, ari: str):
223223 # Retrieve details and wait for completion
224224 retries = 10
225225 while True :
226+ # Wait for request to process before checking state
227+ await asyncio .sleep (1 )
228+
226229 info = do_transcoder_log_by_id (idinfo ["id" ])
230+
227231 if info .parsed_as != "pending" :
228232 break
229233 if retries <= 0 :
230234 return { "idinfo" : idinfo , "info" : info , "status" : 504 }
231- await asyncio .sleep (1 )
232235 retries -= 1
233236
234237 if info .parsed_as == "ERROR" :
235238 return { "idinfo" : idinfo , "info" : info , "status" : 500 }
236-
239+
237240 # Publish
238- status = do_nm_put_hex_eid ( eid , info .cbor )
241+ state = do_nm_put_hex_eid ( eid , info .cbor )
239242
240- return { "idinfo" : idinfo , "info" : info , "status" : status }
243+ return { "idinfo" : idinfo , "info" : info , "status" : state }
241244 except Exception as e :
242245 logger .exception (e )
243246 return status .HTTP_500_INTERNAL_SERVER_ERROR
0 commit comments