fix: ensure_merchant_roles 热路径快速返回 + gunicorn 6 workers 缓解排队

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-09 04:45:50 +08:00
parent 45ce0183d8
commit 9e61161a5c
3 changed files with 66 additions and 2 deletions

28
deploy/apply-lag-fix.sh Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# 部署卡顿修复并验证 rt=
set -e
DJANGO_DIR="/opt/1panel/apps/openresty/nginx/www/sites/43.142.166.152.443/django"
NGINX_LOG="/opt/1panel/apps/openresty/nginx/log/access.log"
cd "$DJANGO_DIR"
echo ">>> git pull"
git pull origin main
echo ">>> 更新 systemd (6 workers)"
cp deploy/systemd/gunicorn-dianjing.service /etc/systemd/system/gunicorn-dianjing.service
systemctl daemon-reload
systemctl restart gunicorn-dianjing.service
sleep 2
systemctl is-active gunicorn-dianjing.service
pgrep -cf 'gunicorn.*a_long_dianjing' || true
echo ""
echo ">>> 最近慢请求 (rt>=0.5s):"
grep -a 'hqhd' "$NGINX_LOG" | awk 'match($0,/rt=([0-9.]+)/,a){if(a[1]+0>=0.5)print}' | tail -5
echo ""
echo ">>> 最近 dddhq / merchant-staff/me:"
grep -a 'hqhd' "$NGINX_LOG" | grep -E 'ddhq|merchant-staff/me' | tail -8 | awk 'match($0,/rt=([0-9.]+)/,a){rt=a[1]} match($0,/POST ([^ ]+)/,b){print " rt="rt"s "b[1]}'
echo ""
echo "部署完成。请用手机再试,然后看上面 rt 是否都 <0.2s"