From 655f61a1876bc7e759244b2857ec1eabf49c7740 Mon Sep 17 00:00:00 2001 From: zhsama Date: Tue, 10 Feb 2026 23:06:51 +0800 Subject: [PATCH] chore: Improve dev API startup script with worker and error handling --- dev/start-api-without-debug | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dev/start-api-without-debug b/dev/start-api-without-debug index c6136ed5e1..b329839848 100755 --- a/dev/start-api-without-debug +++ b/dev/start-api-without-debug @@ -1,11 +1,28 @@ #!/bin/bash +set -euo pipefail set -x SCRIPT_DIR="$(dirname "$(realpath "$0")")" -cd "$SCRIPT_DIR/../api" +API_DIR="$SCRIPT_DIR/../api" +WORKER_SCRIPT="$SCRIPT_DIR/start-worker" +WORKER_QUEUES="${WORKER_QUEUES:-workflow,workflow_professional,workflow_team,workflow_sandbox,workflow_storage,workflow_based_app_execution,triggered_workflow_dispatcher,trigger_refresh_executor}" + +cleanup() { + if [[ -n "${WORKER_PID:-}" ]] && kill -0 "${WORKER_PID}" >/dev/null 2>&1; then + kill "${WORKER_PID}" + wait "${WORKER_PID}" || true + fi +} + +trap cleanup EXIT + +cd "$API_DIR" uv run flask db upgrade +"$WORKER_SCRIPT" --queues "$WORKER_QUEUES" --loglevel INFO & +WORKER_PID=$! + uv run \ flask run --host 0.0.0.0 --port=5001