Merge branch 'main' into fix/database_inconsistent

This commit is contained in:
Đỗ Xuân Tân 2023-12-28 13:01:46 +07:00 committed by GitHub Enterprise
commit 71ca689e89
3 changed files with 4 additions and 1 deletions

View File

@ -215,6 +215,7 @@ class CtelViewSet(viewsets.ViewSet):
"invoice": invoice_file_objs
}
rq_id = provider_code + "_" + datetime.now().strftime("%Y%m%d%H%M%S") + "_" + uuid.uuid4().hex
count = 0
doc_files_with_type = []
for doc_type, doc_files in files.items():

View File

@ -116,7 +116,7 @@ def process_pdf(rq_id, sub_id, p_type, user_id, files):
file_meta["index_in_request"] = i
file_meta["preprocessing_time"] = preprocessing_time
to_queue.append((fractorized_request_id, sub_id, [b_url], user_id, p_type, file_meta))
# Send to next queue
for sub_rq_id, sub_id, urls, user_id, p_type, metadata in to_queue:
ProcessUtil.send_to_queue2(sub_rq_id, sub_id, urls, user_id, p_type, metadata)

View File

@ -147,6 +147,7 @@ def process_invoice_sbt_result(rq_id, result, metadata):
rq_id = rq_id.split("_sub_")[0]
rq: SubscriptionRequest = SubscriptionRequest.objects.filter(request_id=rq_id).first()
result["metadata"] = metadata
# status = to_status(result)
status = result.get("status", 200)
@ -169,6 +170,7 @@ def process_invoice_sbt_result(rq_id, result, metadata):
rq.ai_inference_start_time = result["metadata"]["ai_inference_start_time"] # advancing the last result
rq.preprocessing_time = result["metadata"]["preprocessing_time"] # advancing the last result
rq.ai_inference_time = time.time() - rq.ai_inference_start_time
rq.save()
else: