Summary #
- Bound pending imports (
DefaultMaxPendingImports = 16: 1 active + up to 15 queued) and concurrent dry-run previews (DefaultMaxConcurrentPreviews = 4) via independentchan struct{}semaphores onserver.Server. - Reject excess requests immediately in
handleImportwith429 Too Many Requests("import queue is full"or"too many concurrent dry-run previews") after request validation and before opening an SSE stream (newSSEStream), holding each slot viadeferuntil the handler completes. - Add behavioral unit tests verifying
429admission rejection without SSE framing on saturated pending imports, independentdry_run: trueexecution while the import queue is saturated, and429rejection + slot recovery onMaxConcurrentPreviews.
Verification #
gofmt -l .go vet ./...go test -race -count=1 ./...