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

@@ -307,3 +307,4 @@ Level 3: 兜底Prompt缓存也失效

View File

@@ -493,3 +493,4 @@ const pageSize = Number(query.pageSize) || 20;

View File

@@ -227,3 +227,4 @@ ADMIN-运营管理端/

View File

@@ -326,3 +326,4 @@ INST-机构管理端/

View File

@@ -893,3 +893,4 @@ export interface SlashCommand {

View File

@@ -198,3 +198,4 @@ export type AgentStage = 'topic' | 'design' | 'review' | 'data' | 'writing';

View File

@@ -1305,5 +1305,6 @@ interface FulltextScreeningResult {

View File

@@ -419,5 +419,6 @@ GET /api/v1/asl/fulltext-screening/tasks/:taskId/export

View File

@@ -521,5 +521,6 @@ Failed to open file '\\tmp\\extraction_service\\temp_10000_test.pdf'

View File

@@ -587,5 +587,6 @@ df['creatinine'] = pd.to_numeric(df['creatinine'], errors='coerce')

View File

@@ -1002,5 +1002,6 @@ export const aiController = new AIController();

View File

@@ -1336,5 +1336,6 @@ npm install react-markdown

View File

@@ -244,5 +244,6 @@ FMA___基线 | FMA___1个月 | FMA___2个月

View File

@@ -402,5 +402,6 @@ formula = "FMA总分0-100 / 100"

View File

@@ -236,5 +236,6 @@ async handleFillnaMice(request, reply) {

View File

@@ -208,5 +208,6 @@ method: 'mean' | 'median' | 'mode' | 'constant' | 'ffill' | 'bfill'

View File

@@ -659,5 +659,6 @@ import { logger } from '../../../../common/logging/index.js';

View File

@@ -462,5 +462,6 @@ import { ChatContainer } from '@/shared/components/Chat';

View File

@@ -372,5 +372,6 @@ const initialMessages = defaultMessages.length > 0 ? defaultMessages : [{

View File

@@ -660,5 +660,6 @@ http://localhost:5173/data-cleaning/tool-c

View File

@@ -448,5 +448,6 @@ Docs: docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建

View File

@@ -321,5 +321,6 @@ ConflictDetectionService // 冲突检测(字段级对比)

View File

@@ -485,5 +485,6 @@ Tool B后端代码**100%复用**了平台通用能力层,无任何重复开发

View File

@@ -262,5 +262,6 @@ $ node scripts/check-dc-tables.mjs

View File

@@ -495,5 +495,6 @@ ${fields.map((f, i) => `${i + 1}. ${f.name}${f.desc}`).join('\n')}

View File

@@ -700,5 +700,6 @@ private async processMessageAsync(xmlData: any) {

View File

@@ -1094,5 +1094,6 @@ async function testIntegration() {

View File

@@ -235,5 +235,6 @@ Content-Type: application/json

View File

@@ -655,5 +655,6 @@ REDCap API: exportRecords success { recordCount: 1 }

View File

@@ -661,5 +661,6 @@ backend/src/modules/iit-manager/

View File

@@ -811,5 +811,6 @@ CREATE TABLE iit_schema.wechat_tokens (

View File

@@ -568,5 +568,6 @@ Day 3 的开发工作虽然遇到了多个技术问题,但最终成功完成

View File

@@ -335,5 +335,6 @@ AI: "出生日期2017-01-04

View File

@@ -279,5 +279,6 @@ Day 4: REDCap EMWebhook推送← 作为增强,而非核心

View File

@@ -693,5 +693,6 @@ const answer = `根据研究方案[1]和CRF表格[2],纳入标准包括:

View File

@@ -452,3 +452,4 @@ export const calculateAvailableQuota = async (tenantId: string) => {

View File

@@ -325,3 +325,4 @@ https://platform.example.com/t/pharma-abc/login

View File

@@ -374,4 +374,5 @@ const newResults = resultsData.map((docResult: any) => ({

View File

@@ -783,5 +783,6 @@ docker exec redcap-apache php /tmp/create-redcap-password.php

View File

@@ -165,5 +165,6 @@ AIclinicalresearch/redcap-docker-dev/