.vbw-planning/milestones/polish-and-reliability/phases/01-backend-fixes/PLAN-03.md
Remove the default per-source scrape limit (was 25) so Solid Queue's worker pool provides natural backpressure. Users who want a cap can still set config.scraping.max_in_flight_per_source.
@lib/source_monitor/configuration/scraping_settings.rb -- DEFAULT_MAX_IN_FLIGHT = 25 (line 8), reset! (line 16)@lib/source_monitor/scraping/enqueuer.rb -- rate_limit_exhausted? (lines 108-114), returns early if limit is nil@lib/source_monitor/scraping/bulk_result_presenter.rb -- line 58: shows limit only if non-nil@test/lib/source_monitor/scraping/bulk_source_scraper_test.rb -- "respects per-source rate limit" (line 88)@test/lib/source_monitor/scraping/enqueuer_test.rb -- "enforces per-source in-flight rate limit" (line 71)REQ-SL-01: Refine max_in_flight_per_source to only count actively-running scrape jobs (not queued ones).
Decision: Simpler approach -- remove the default limit entirely (set to nil). The rate_limit_exhausted? method, BulkResultPresenter, and BulkSourceScraper already handle nil correctly by skipping the check.
Files: lib/source_monitor/configuration/scraping_settings.rb
DEFAULT_MAX_IN_FLIGHT = nil (was 25)reset! method at line 16 already uses DEFAULT_MAX_IN_FLIGHT, so it will pick up nil automaticallyNo other code changes needed -- Enqueuer#rate_limit_exhausted? returns [false, nil] when limit is nil (line 110), BulkResultPresenter only shows the limit message when limit is non-nil (line 58).
Files: test/lib/source_monitor/scraping/bulk_source_scraper_test.rb, test/lib/source_monitor/scraping/enqueuer_test.rb
Review tests that rely on the default limit:
bulk_source_scraper_test.rb "respects per-source rate limit" (line 88): Already explicitly sets config.scraping.max_in_flight_per_source = 2 -- no change neededenqueuer_test.rb "enforces per-source in-flight rate limit" (line 71): Already explicitly sets config.scraping.max_in_flight_per_source = 1 -- no change neededbulk_source_scraper_test.rb "determine_status returns :partial" (line 307): Already explicitly sets config.scraping.max_in_flight_per_source = 2 -- no change neededAll rate-limit tests already set explicit limits -- the default value change has no impact on them.
Files: test/lib/source_monitor/scraping/enqueuer_test.rb
Add test:
"does not rate-limit when default max_in_flight is nil"
pending status (e.g., 30)Enqueuer.enqueue(item: eligible_item):enqueued (not rate_limited)"rate-limits when user explicitly sets max_in_flight_per_source"
Files: test/lib/source_monitor/scraping/bulk_result_presenter_test.rb
Check existing tests. If no test covers the rate_limited path with a nil limit:
rate_limited: true, construct presenter, verify message says "Stopped after reaching the per-source limit" without a number suffix| Action | Path |
|---|---|
| MODIFY | lib/source_monitor/configuration/scraping_settings.rb |
| MODIFY | test/lib/source_monitor/scraping/enqueuer_test.rb |
| MODIFY | test/lib/source_monitor/scraping/bulk_result_presenter_test.rb |
bin/rails test test/lib/source_monitor/scraping/enqueuer_test.rb test/lib/source_monitor/scraping/bulk_source_scraper_test.rb test/lib/source_monitor/scraping/bulk_result_presenter_test.rb
bin/rubocop lib/source_monitor/configuration/scraping_settings.rb
ScrapingSettings.new.max_in_flight_per_source returns nil by default