Closes #61.
## Why
`scan_all_repos` awaited each target's `run_target_scan` in turn, and the tick awaited each tenant in turn. So for scheduled scans:
- one slow repository held up every other target;
- `SCAN_CONCURRENCY` (the `ScanGate` slots) never came into play;
- the 30 s start jitter, which is meant to spread concurrent starts, only added delay.
## What
- The tick starts every tenant's scans together (`join_all`).
- `scan_all_repos` starts every target together (`for_each_concurrent(None, …)`).
- `run_target_scan` is unchanged. It still:
- takes the jitter;
- coalesces with a running scan of the same target;
- waits for a global slot.
So at most `SCAN_CONCURRENCY` scans run at once, exactly as for webhooks and manual scans.
## Prod note
Prod runs `SCAN_CONCURRENCY=1` since 03.11. (orca-platform #147), so prod behaviour stays one scan at a time until that goes back to 2.
## Tests
No new unit test: the change is the loop shape, and the gating it relies on is covered by `scan_gate`'s tests. Built in CI only.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
The scan tick awaited every tenant and every target one after another,
so one slow repository held up all the others and SCAN_CONCURRENCY never
applied to scheduled scans. The tick now starts them all; each scan
waits for one of the SCAN_CONCURRENCY slots (ScanGate), and the existing
start jitter of up to 30 s spreads them out.
Closes#61.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang
merged commit 93b98965b3 into main2026-11-04 08:17:59 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #61.
Why
scan_all_reposawaited each target'srun_target_scanin turn, and the tick awaited each tenant in turn. So for scheduled scans:SCAN_CONCURRENCY(theScanGateslots) never came into play;What
join_all).scan_all_reposstarts every target together (for_each_concurrent(None, …)).run_target_scanis unchanged. It still:So at most
SCAN_CONCURRENCYscans run at once, exactly as for webhooks and manual scans.Prod note
Prod runs
SCAN_CONCURRENCY=1since 03.11. (orca-platform #147), so prod behaviour stays one scan at a time until that goes back to 2.Tests
No new unit test: the change is the loop shape, and the gating it relies on is covered by
scan_gate's tests. Built in CI only.🤖 Generated with Claude Code