Skip to content

perf: bounded concurrency for synchronizeAllRepositories (3-way)#46

Open
avrabe wants to merge 1 commit intomainfrom
perf/sync-all-repos-concurrency
Open

perf: bounded concurrency for synchronizeAllRepositories (3-way)#46
avrabe wants to merge 1 commit intomainfrom
perf/sync-all-repos-concurrency

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 1, 2026

Fixes Bug #21 from docs/agent-fleet/bugs.md (wave-1 Performance + Probot expert).

Inline pLimitMap helper (~12 lines, no dep). concurrency=3 — overlaps GitHub round-trips without saturating CPU or rate-limit. Per-repo behaviour unchanged.

  • 834 tests pass
  • eslint clean

🤖 Generated with Claude Code

## Why
Wave-1 Performance and Probot/Octokit agents flagged this as Bug #21 in
`docs/agent-fleet/bugs.md`. The org-wide sweep runs `configureRepository`
fully serially: ~30-60 s for 13 repos, ~5+ minutes for 100. Each repo
config issues 4-6 GitHub API calls; serial means most of that wall time
is round-trip latency, not work.

Fully parallel risks blowing the GitHub 5000/h core budget on a
100-repo org and saturating the 2-core netcup VPS. The textbook answer
is bounded concurrency.

## What
Inline `pLimitMap(items, concurrency, fn)` helper (~12 lines, no
dependency). Workers pull from a shared cursor; bounded by `concurrency`.
Used at `concurrency=3` — enough to overlap GitHub round-trips, light
enough to leave headroom for the webhook hot path.

The sequential filtering of `archived` and `isControlSurfaceRepo` repos
is preserved before dispatch, so per-iteration log lines stay readable.

## Source
Bug #21, wave-1 Performance / Probot expert (`docs/agent-fleet/bugs.md`).

## Test plan
- [x] 834 tests pass
- [x] eslint clean
- [ ] After merge + a `/sync-all-repos` invocation in temper-ops: wall
      time should drop from ~30 s → ~10-15 s for 13-repo org. Visible
      in the bot's "Synchronized X repositories" reply timing.

## Risk & rollout
- Risk: low. Same per-repo behaviour, just parallelised. Each repo's
  failure is still locally caught and logged. Failure of one doesn't
  cancel others (was true before too).
- Rollout: self-update on merge.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant