feat(platform): Fix pg-boss queue conflict and add safety standards

Summary:
- Fix pg-boss queue conflict (duplicate key violation on queue_pkey)
- Add global error listener to prevent process crash
- Reduce connection pool from 10 to 4
- Add graceful shutdown handling (SIGTERM/SIGINT)
- Fix researchWorker recursive call bug in catch block
- Make screeningWorker idempotent using upsert

Security Standards (v1.1):
- Prohibit recursive retry in Worker catch blocks
- Prohibit payload bloat (only store fileKey/ID in job.data)
- Require Worker idempotency (upsert + unique constraint)
- Recommend task-specific expireInSeconds settings
- Document graceful shutdown pattern

New Features:
- PKB signed URL endpoint for document preview/download
- pg_bigm installation guide for Docker
- Dockerfile.postgres-with-extensions for pgvector + pg_bigm

Documentation:
- Update Postgres-Only async task processing guide (v1.1)
- Add troubleshooting SQL queries
- Update safety checklist

Tested: Local verification passed
This commit is contained in:
2026-01-23 22:07:26 +08:00
parent 9c96f75c52
commit 61cdc97eeb
297 changed files with 1147 additions and 21 deletions

View File

@@ -902,5 +902,6 @@ ACR镜像仓库

View File

@@ -1389,5 +1389,6 @@ SAE应用配置:

View File

@@ -1205,5 +1205,6 @@ docker exec -e PGPASSWORD="密码" ai-clinical-postgres psql -h RDS地址 -U air

View File

@@ -616,5 +616,6 @@ scripts/*.ts

View File

@@ -304,5 +304,6 @@ Node.js后端部署成功后

View File

@@ -527,5 +527,6 @@ Node.js后端 (SAE) ← http://172.17.173.88:3001

View File

@@ -242,5 +242,6 @@ curl http://localhost:3001/health

View File

@@ -280,5 +280,6 @@ npm run dev

View File

@@ -504,5 +504,6 @@ pgm-2zex1m2y3r23hdn5.pg.rds.aliyuncs.com:5432

View File

@@ -1832,5 +1832,6 @@ curl http://8.140.53.236/

View File

@@ -380,5 +380,6 @@ crpi-cd5ij4pjt65mweeo.cn-beijing.personal.cr.aliyuncs.com/ai-clinical/backend-se

View File

@@ -702,5 +702,6 @@ docker login --username=gofeng117@163.com \

View File

@@ -513,5 +513,6 @@ NAT网关成本¥100/月,对初创团队是一笔开销