worker: the scheduler double-emits every recurring job if outpost-worker scales past 1
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- backend, distributed-systems
Research direction
Start with packages/outpost/queue/src/scheduler.ts:79 and apps/worker/src/index.ts:94,117 to trace scheduler construction and startup. Inspect the SystemConfig table and existing issue #133 for relevant coordination context. Done means recurring jobs are emitted by only one worker replica when outpost-worker scales past one, without duplicate enqueues.
Written by the indexing model from the issue text.
Description
packages/outpost/queue/src/scheduler.ts:79 schedules recurring jobs with a plain in-process interval:
const timer = setInterval(() => this.tick(definition), definition.intervalMs);
apps/worker/src/index.ts:94 constructs one Scheduler per process and starts it at :117. With a single outpost-worker replica this is correct. At two replicas, both tick, and every scheduled job type — SLA_CHECK, ONBOARDING_DIGEST, GITHUB_REACTION_POLL, ACCOUNT_SCORING, JOB_CLEANUP — is enqueued twice per interval.
Why it matters
It is a scaling landmine rather than a live defect: nothing warns you, and the first symptom would be duplicate outbound posts from the digest, which is exactly the class of bug #133 was filed to prevent.
Fix
Leader election on the SystemConfig table — a lease row the scheduler must hold, renewed each tick, so exactly one replica emits. Alternatively, split the scheduler into its own single-replica service. Either way, worth landing before anyone scales the worker, not after.
- Dominant language
- TypeScript
- Stars
- 12
- Forks
- 6
- Avg merge
- 2h 23m
- Merged PRs (30d)
- 2
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CopilotKit/outpost
-
area: docs area: security roadmap: now
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
CopilotKit/outpost#277 ·
Maintainers usually reply within 1 day
-
area: infrastructure roadmap roadmap: later
Difficulty 1/5 Under an hour Newbie friendliness 74/100
CopilotKit/outpost#179 ·
Maintainers usually reply within 1 day
-
area: ai roadmap roadmap: now
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CopilotKit/outpost#145 ·
Maintainers usually reply within 1 day
-
area: integrations priority: low roadmap roadmap: later
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
CopilotKit/outpost#124 · 3 comments ·
Maintainers usually reply within 1 day
-
area: integrations priority: low roadmap roadmap: later
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
CopilotKit/outpost#123 · 2 comments ·
Maintainers usually reply within 1 day
All issues in CopilotKit/outpost
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 70/100
siyuan-note/siyuan#20517 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
NaturalIntelligence/fast-xml-parser#890 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
zsviczian/obsidian-excalidraw-plugin#3000 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pnpm/get.pnpm.io#68 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nuxt-modules/better-auth#578 · 2 comments ·
Maintainers usually reply within 1 day