fix(worker): break circular import by extracting PgBoss singleton

incremental-sync.ts and api/cw/sync.ts imported getBoss() from workert.ts.
When workert.ts (the entry point) dynamically imported incremental-sync.ts,
it triggered a circular module re-evaluation that hung indefinitely.

Extract the PgBoss singleton and getBoss() factory to a new boss-instance.ts
module that neither has top-level async side-effects nor imports from
workert.ts. All consumers (workert.ts, index.ts, incremental-sync.ts,
cw/sync.ts) now import from boss-instance.ts instead.
This commit is contained in:
2026-04-14 00:34:33 +00:00
parent db27c9224d
commit 2eb387811d
5 changed files with 35 additions and 34 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import { getBoss } from "../../workert";
import { getBoss } from "../../boss-instance";
import { WorkerQueue } from "./queues";
/**