Kaizen
Browse modulesInsightsinsights/schedulingInterfaces

Interface: ReconcileReportSchedulesDeps

Defined in: server/insights/scheduling/report-schedule-service.ts:802

Re-register BullMQ schedulers for every enabled schedule across all orgs. Run this at WORKER STARTUP: it closes the one window the write paths cannot make atomic — a crash between a row write and upsertJobScheduler (in create or setEnabled(true)) leaves an enabled row whose scheduler is missing, so it silently never fires. upsertJobScheduler is idempotent, so re-registering a live scheduler is a no-op; the sweep only heals the missing ones. Each row is re-read during a short mutation-lock transaction, then Redis is updated only after that transaction commits. The same post-write fence check as request mutations prevents a stale sweep snapshot from reverting a concurrent edit. Reverse drift is healed when the worker removes a scheduler whose row is absent or paused.

Idiomatic taproot: the library exposes this idempotent tick; the consumer's worker process drives it once on boot (and may re-run it on a timer).

Properties

organizationIds?

optional organizationIds?: readonly string[];

Defined in: server/insights/scheduling/report-schedule-service.ts:814

Trusted tenant inventory supplied by the consumer's organization store.


queue

queue: ReportScheduleQueue;

Defined in: server/insights/scheduling/report-schedule-service.ts:807


repo

repo: Pick<ReportScheduleRepository, "getSchedulerState" | "listEnabledForReconcile" | "withMutationLock">;

Defined in: server/insights/scheduling/report-schedule-service.ts:803


runInTenantContext?

optional runInTenantContext?: RunInReportScheduleTenantContext;

Defined in: server/insights/scheduling/report-schedule-service.ts:819

External-context bridge. Pair it with tenancy.resolveBinding; omit both to use Taproot's tenant context.


tenancy?

optional tenancy?: TenancyConfig;

Defined in: server/insights/scheduling/report-schedule-service.ts:812

Optional RLS integration. When present, organizationIds is required so reconciliation never needs a privileged cross-tenant database scan.

On this page