Scale biz_state collects with dedicated workers and non-blocking UI poll.

Add PG claim/NE mutex, persist pool, and biz_state_worker replicas; fix double-SSH and row-count bugs; stop 32m collectNow while-loop from freezing page switches.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-22 17:00:37 +08:00
parent 0eb65a839e
commit 3a0de0d7fb
22 changed files with 1210 additions and 165 deletions

View file

@ -239,6 +239,21 @@ if [[ "${INLINE_SCHEDULERS}" != "1" ]]; then
echo "PID = ${WORKER_PID}"
echo "Log = ${WORKER_LOG_FILE}"
echo "Err = ${WORKER_ERR_FILE}"
REPLICAS="${NETX_BIZ_STATE_WORKER_REPLICAS:-2}"
if [[ "${REPLICAS}" -lt 1 ]]; then REPLICAS=1; fi
BIZ_DIR="${RUN_DIR}/biz_state_workers"
mkdir -p "${BIZ_DIR}"
echo "==> Starting biz_state workers (replicas=${REPLICAS})"
for ((i=0; i<REPLICAS; i++)); do
(
cd "${ROOT_DIR}"
nohup "${PYTHON_CMD}" -m netx_api.biz_state_worker \
>"${BIZ_DIR}/worker${i}.out.log" 2>"${BIZ_DIR}/worker${i}.err.log" &
echo $! > "${BIZ_DIR}/worker${i}.pid"
)
echo "biz_state_worker[${i}] PID=$(cat "${BIZ_DIR}/worker${i}.pid")"
done
fi
if [[ "${API_ONLY}" != "1" ]]; then