Skip to content

fix(backend): Limit concurrent git operations to prevent resource exhaustion - #593

Merged
brendan-kellam merged 1 commit into
sourcebot-dev:mainfrom
derek-miller:main
Nov 1, 2025
Merged

brendan-kellam merged 1 commit into
sourcebot-dev:mainfrom
derek-miller:main

Conversation

@derek-miller

@derek-miller derek-miller commented Nov 1, 2025 •

Copy link
Copy Markdown
Contributor

When syncing generic-git-host connections with thousands of repositories, unbounded Promise.all caused resource exhaustion (EAGAIN errors) by spawning too many concurrent git processes. This resulted in valid repositories being incorrectly skipped during sync.

  • Add p-limit to control concurrent git operations (max 100)
  • Follow existing pattern from github.ts for consistency
  • Prevents file descriptor and process limit exhaustion
  • Uses rolling concurrency to avoid head-of-line blocking

Fixes #590

@coderabbitai

coderabbitai Bot commented Nov 1, 2025

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@derek-miller derek-miller changed the title fix(backend): Limit concurrent git operations to prevent resource exh… fix(backend): Limit concurrent git operations to prevent resource exhaustion Nov 1, 2025
brendan-kellam
brendan-kellam previously approved these changes Nov 1, 2025

@brendan-kellam brendan-kellam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks

…austion (#590)

When syncing generic-git-host connections with thousands of repositories,
unbounded Promise.all caused resource exhaustion (EAGAIN errors) by spawning
too many concurrent git processes. This resulted in valid repositories being
incorrectly skipped during sync.

- Add p-limit to control concurrent git operations (max 100)
- Follow existing pattern from github.ts for consistency
- Prevents file descriptor and process limit exhaustion
- Uses rolling concurrency to avoid head-of-line blocking

Fixes #590
@derek-miller

Copy link
Copy Markdown
Contributor Author

@brendan-kellam Fixed the CI issue. Good to merge

@brendan-kellam
brendan-kellam merged commit 2c0540f into sourcebot-dev:main Nov 1, 2025
5 checks passed
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.

[bug] Promise.all resource exhaustion causes thousands of repos to be skipped during generic-git-host connection sync

3 participants