fix(analyzer): import worker from analyze route to trigger auto-start

worker.ts has a self-init side effect on module load, but nothing in the
shipped code imported it — so jobs queued but no worker ran. Adding a
side-effect import to the analyze route handler; Next.js eagerly loads
route modules at boot to build the routing manifest, so this runs once
per server process. Confirmed live: [ANALYZER-WORKER] starting log line
fires on container start.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
lorentz 2026-04-29 11:21:10 -04:00
parent 1c5ec0f947
commit 966376e6b6

View file

@ -23,6 +23,10 @@ import {
findExistingAnalysisByContentHash,
queueJob,
} from '@/lib/services/analyzer/persistence';
// Side-effect import: triggers the worker's auto-start at server boot. Next.js
// eagerly loads route handler modules to build the routing manifest, so this
// import runs once per server process — same trick sync-scheduler relies on.
import '@/lib/services/analyzer/worker';
export async function POST(
request: NextRequest,