feat(09-02): wire initOutboxTrigger() at startup under isMainModule() in index.ts
- extend outboxWorker import to include initOutboxTrigger alongside startOutboxWorker - call initOutboxTrigger() immediately after startOutboxWorker() inside isMainModule() guard - gated by isMainModule() so tests importing app never register the drain listener (Pitfall 4)
This commit is contained in:
@@ -13,7 +13,7 @@ import { oidcAuthMiddleware, processOAuthCallback } from './auth/middleware.js';
|
|||||||
import { devAuthBypass } from './auth/devBypass.js';
|
import { devAuthBypass } from './auth/devBypass.js';
|
||||||
import { persistSessionCookie } from './auth/persistSessionCookie.js';
|
import { persistSessionCookie } from './auth/persistSessionCookie.js';
|
||||||
import { startBrokerPoller } from './broker/poller.js';
|
import { startBrokerPoller } from './broker/poller.js';
|
||||||
import { startOutboxWorker } from './broker/outboxWorker.js';
|
import { startOutboxWorker, initOutboxTrigger } from './broker/outboxWorker.js';
|
||||||
import { startReminderScheduler } from './broker/reminderScheduler.js';
|
import { startReminderScheduler } from './broker/reminderScheduler.js';
|
||||||
import webpush from 'web-push';
|
import webpush from 'web-push';
|
||||||
|
|
||||||
@@ -136,6 +136,7 @@ if (isMainModule()) {
|
|||||||
startBrokerPoller();
|
startBrokerPoller();
|
||||||
// Drain the D-05 outbox every 15s: dispatches pending CalDAV writes to Fastmail.
|
// Drain the D-05 outbox every 15s: dispatches pending CalDAV writes to Fastmail.
|
||||||
startOutboxWorker();
|
startOutboxWorker();
|
||||||
|
initOutboxTrigger(); // subscribe drain signal listener (D-01)
|
||||||
// Start the 1-min reminder scan for shared timed events starting in ~15 min (NOTIF-01).
|
// Start the 1-min reminder scan for shared timed events starting in ~15 min (NOTIF-01).
|
||||||
// VAPID must be configured (above) before this starts or push sends will fail.
|
// VAPID must be configured (above) before this starts or push sends will fail.
|
||||||
startReminderScheduler();
|
startReminderScheduler();
|
||||||
|
|||||||
Reference in New Issue
Block a user