From 843b68b412fcecf0d0fdd1daced4b7e4e84b125d Mon Sep 17 00:00:00 2001 From: dekun Date: Wed, 1 Jul 2026 08:17:29 +0800 Subject: [PATCH] Stop PM2 before PostgreSQL init to free connection pool. Co-authored-by: Cursor --- scripts/deploy_postgres.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/deploy_postgres.sh b/scripts/deploy_postgres.sh index c2a0651..40fe8d2 100644 --- a/scripts/deploy_postgres.sh +++ b/scripts/deploy_postgres.sh @@ -66,6 +66,12 @@ echo "==> Python 依赖..." source "$APP_DIR/venv/bin/activate" pip install -q -r "$APP_DIR/requirements.txt" +echo "==> 停止 qihuo(释放数据库连接)..." +if pm2 describe qihuo &>/dev/null; then + pm2 stop qihuo || true + sleep 2 +fi + if [ "$MIGRATE_SQLITE" = "1" ]; then echo "==> 重置 PostgreSQL 库(迁移模式)..." sudo -u postgres psql -v ON_ERROR_STOP=0 -c \