From 8e564c1ef46c3818ec5b3a38d9ee5a33c174633d Mon Sep 17 00:00:00 2001 From: Youen Date: Thu, 18 May 2023 23:26:16 +0200 Subject: [PATCH] by default, /api/build doesn't wait for build to complete --- src/api/api_document.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api/api_document.py b/src/api/api_document.py index 4c89fbc..059abb9 100644 --- a/src/api/api_document.py +++ b/src/api/api_document.py @@ -2,6 +2,7 @@ from flask import Blueprint, request from web_utils.get_arg import get_arg from web_utils.business_exception import BusinessException import os +import time from data.document import Document @@ -13,13 +14,18 @@ def build(): doc_name = get_arg('doc_name') branch = get_arg('branch', 'master') apikey = get_arg('apikey') + join = get_arg('join', 'false') doc = Document(origin, doc_name, branch) if doc.get_api_key() != apikey: raise BusinessException("Invalid API key") build_task = doc.build() - build_task.join() + + if join == 'true': + build_task.join() + else: + time.sleep(1) return build_task.get_output_str().replace('\n', '
\n')