Skip to content

CommitterWorker

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/apps/api/src/docs-repo/committer.worker.ts

CommitterWorker — the single, gated consumer of the 'docs-repo' queue.

Only spins up where DOCS_REPO_WORKER==='true' (a dedicated 1-replica deployment); api pods enqueue-only. Concurrency 1 per project is enforced by the FAIL-CLOSED commit lock, not by BullMQ groups: a job takes the per-project lock, drains that project's outbox, writes a single coalesced commit (DB-wins rebuild), then marks the drained rows processed. If the lock is held (another commit in flight) or Redis is down (fail-closed), the job is re-delayed rather than committing.

Implements: OnModuleInit, OnModuleDestroy

Methods

MethodSignatureReturns
onModuleInitonModuleInit()void
commitUnderLockcommitUnderLock(projectId: string)`Promise<string
commitProjectcommitProject(projectId: string)`Promise<string
onModuleDestroyonModuleDestroy()Promise<void>

Where it refuses work

  • CommitterWorker stops the work with an early return when pending.length === 0.
  • CommitterWorker stops the work with an early return when humanIds.length === 0.
  • CommitterWorker stops the work with an early return when humans.length === 0.
  • CommitterWorker stops the work with an early return when humanIds.length === 1.

When something fails

  • CommitterWorker handles failure in 4 places: it lets it reach the caller in 3, and turns it into a return value in 1.

Referenced By

  • DocsRepoModule (MODULE_PROVIDES)

Was this page helpful?

Download as PDF