Kind: Class
Source: atloria-monorepo/apps/api/src/git-sync/mirror.worker.ts
GitSyncWorker — the single, gated consumer of the 'docs-sync' queue, PLUS the cron sweep that produces its jobs.
Only spins up where DOCS_REPO_WORKER==='true' (the deployment that mounts the docs-repos
PVC — the mirror reads the substrate via read-only git show/ls-tree at a pinned sha,
which never touches the shared working tree, so it runs WITHOUT the commit lock and can't
interleave badly with the committer). Api pods enqueue-only.
SWEEP (every minute, worker only — OutboxPoller pattern): any sync with direction outbound/two-way whose project's ProjectDocsRepo.headCommit has moved past lastSourceSha gets one coalesced mirror job (deduped by the deterministic jobId). This needs NO hook in the committer: the reconciler already maintains headCommit on every rebuild.
Implements: OnModuleInit, OnModuleDestroy
Methods
| Method | Signature | Returns |
|---|---|---|
onModuleInit | onModuleInit() | void |
sweep | sweep() | Promise<void> |
enqueuePending | enqueuePending() | Promise<number> |
onModuleDestroy | onModuleDestroy() | Promise<void> |
Where it refuses work
GitSyncWorkerstops the work with an early return whenjob.data.type !== 'mirror'.GitSyncWorkerstops the work with an early return whenthis.config.get<string>('DOCS_REPO_WORKER') !== 'true'.
When something fails
GitSyncWorkerhandles failure in 1 place: it logs it and continues in all 1.
Referenced By
GitSyncModule(MODULE_PROVIDES)
Was this page helpful?