From ebbb031ae3d338d750047ba49458a241ecf73cbb Mon Sep 17 00:00:00 2001 From: Mateusz Russak Date: Mon, 16 Dec 2024 15:25:14 +0100 Subject: [PATCH] feat: ability to set timeout for deployment --- src/writer/deploy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/writer/deploy.py b/src/writer/deploy.py index f6868dd8f..98ab67940 100644 --- a/src/writer/deploy.py +++ b/src/writer/deploy.py @@ -15,6 +15,7 @@ import requests from gitignore_parser import parse_gitignore +DEPLOY_TIMEOUT = int(os.getenv("WRITER_DEPLOY_TIMEOUT", 20)) @click.group() def cloud(): @@ -261,7 +262,7 @@ def upload_package(deploy_url, tar, token, env, verbose=False, sleep_interval=5) print("Package uploaded. Building...") status = "WAITING" url = "" - while status not in ["COMPLETED", "FAILED"] and datetime.now(pytz.timezone('UTC')) < build_time + timedelta(minutes=5): + while status not in ["COMPLETED", "FAILED"] and datetime.now(pytz.timezone('UTC')) < build_time + timedelta(minutes=DEPLOY_TIMEOUT): end_time = datetime.now(pytz.timezone('UTC')) status, url = check_service_status(deploy_url, token, build_id, build_time, start_time, end_time, status) time.sleep(sleep_interval)