Skip to content

refactor(app): replace the scan semaphore with a limited dispatcher - #91

Merged
rocketraman merged 1 commit into
masterfrom
claude/gitvantage-scan-dispatcher
Nov 18, 2026
Merged

rocketraman merged 1 commit into
masterfrom
claude/gitvantage-scan-dispatcher

Conversation

@rocketraman

Copy link
Copy Markdown
Owner

Follow-up to #89, which gave background scans their own limitedParallelism(2) dispatcher. This replaces the remaining Semaphore(8) the same way.

Change

  • scanLimiter is replaced by foregroundGit = Dispatchers.IO.limitedParallelism(8). It's used for scans someone is waiting on: startup, Refresh, adding repos, and foreground rescanRepos. Push all uses it too.
  • RepoOps.push takes a dispatcher parameter, like RepoScanner.scan. Both switch to their own dispatcher internally, so wrapping the call in withContext would escape the limit.
  • rescanRepos now picks backgroundScans or foregroundGit in one line.

Behavior change

Single-repo commit, stash apply/drop and fast-forward are no longer limited. Each is one repo's git calls in a row, and the semaphore only made them wait behind a batch scan for a slot. Their withContext(Dispatchers.Default) wrappers are gone too, since RepoOps already switches to IO.

Testing

  • 295 tests, 0 failures, all from this run (checked the timestamps in the result XML). detekt is clean.
  • No test checks that the dispatchers actually cap concurrency.

Scans and batch pushes that someone is waiting on now run on
Dispatchers.IO.limitedParallelism(8) instead of taking permits from
Semaphore(8). This matches the background scans, which already work this
way.

RepoOps.push takes the dispatcher as a parameter, as RepoScanner.scan
does. Both switch to their own dispatcher internally, so wrapping the
call in withContext would escape the limit.

Single-repo commit, stash apply/drop and fast-forward are no longer
limited. Each is one repo's git calls in a row, and the semaphore only
made them wait behind a batch scan. Their withContext(Dispatchers.Default)
wrappers are gone too: RepoOps already switches to IO.

Signed-off-by: Raman Gupta <rocketraman@gmail.com>
@rocketraman
rocketraman merged commit c68eea8 into master Nov 18, 2026
2 checks passed
@rocketraman
rocketraman deleted the claude/gitvantage-scan-dispatcher branch November 18, 2026 05:22
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