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
48 lines
1.1 KiB
SQL
48 lines
1.1 KiB
SQL
-- 恢复 platform_schema.job_common 表
|
|
-- 从备份文件 rds_init_20251224_154529.sql 提取
|
|
|
|
CREATE TABLE IF NOT EXISTS platform_schema.job_common (
|
|
id uuid DEFAULT gen_random_uuid() NOT NULL,
|
|
name text NOT NULL,
|
|
priority integer DEFAULT 0 NOT NULL,
|
|
data jsonb,
|
|
state platform_schema.job_state DEFAULT 'created'::platform_schema.job_state NOT NULL,
|
|
retry_limit integer DEFAULT 2 NOT NULL,
|
|
retry_count integer DEFAULT 0 NOT NULL,
|
|
retry_delay integer DEFAULT 0 NOT NULL,
|
|
retry_backoff boolean DEFAULT false NOT NULL,
|
|
retry_delay_max integer,
|
|
expire_seconds integer DEFAULT 900 NOT NULL,
|
|
deletion_seconds integer DEFAULT 604800 NOT NULL,
|
|
singleton_key text,
|
|
singleton_on timestamp without time zone,
|
|
start_after timestamp with time zone DEFAULT now() NOT NULL,
|
|
created_on timestamp with time zone DEFAULT now() NOT NULL,
|
|
started_on timestamp with time zone,
|
|
completed_on timestamp with time zone,
|
|
keep_until timestamp with time zone DEFAULT (now() + '336:00:00'::interval) NOT NULL,
|
|
output jsonb,
|
|
dead_letter text,
|
|
policy text
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|