.vbw-planning/milestones/polish-and-reliability/phases/06-fetch-throughput-defaults/06-RESEARCH.md
Current state:
fetch_queue_concurrency defaults to 2 (lib/source_monitor/configuration.rb:40)DEFAULT_BATCH_SIZE = 100 in Scheduler (lib/source_monitor/scheduler.rb:8)test/dummy/config/recurring.yml)limits_concurrency from Solid Queue is used; advisory locks per-source onlyfetch_feed_job.rb:5,11-13)Math: With concurrency=2 and ~2s avg fetch time, throughput is ~60 jobs/min. But with 100 jobs enqueued per batch cycle, backlog grows continuously.
Current state:
ImportOpmlJob#build_attributes does NOT set next_fetch_at -- all imported sources start as NULL (immediately due)SourcesController#create also has no next_fetch_at initializationtable[:next_fetch_at].eq(nil).or(table[:next_fetch_at].lteq(now)))Time.current + fixed_minutes.minutes exactlyJITTER_PERCENT = 0.1) but insufficient when base times are nearly identicalCurrent state:
update_source_state! (fetch_runner.rb:83-91) rescues ALL StandardError including DB update failuresensure block guarantees fetch_status reset from "fetching" to "idle"/"failed"FollowUpHandler#call has no error handling -- exceptions propagate past mark_complete!StalledFetchReconciler recovers after 10 minutes (STALE_QUEUE_TIMEOUT = 10.minutes)config.fetch_queue_concurrency -- defaults to 2config.fetch_queue_name / config.scrape_queue_name -- queue namesENV["SOURCE_MONITOR_FETCH_CONCURRENCY"] -- env var override in example configconfig.fetching.adaptive_enabled -- toggle adaptive intervalsconfig.fetching.increase_factor / decrease_factor -- interval tuningconfig.fetching.min_interval / max_interval -- interval boundsconfig.http.timeout / config.http.open_timeout -- HTTP timeoutsconfig.http.max_retries -- retry countSourceMonitor.configure { |config| ... } -- new knobs should follow the same pattern via settings sub-objectslib/source_monitor/configuration/fetching_settings.rb): Already has adaptive interval knobs; batch size and jitter should live hereupdate_source_state! to only catch broadcast errorsensure block in FetchRunner#run for status safety netFollowUpHandler#callnext_fetch_at during OPML importJITTER_PERCENT configurable via FetchingSettingsfetch_queue_concurrency to 2 (keep current) -- it's actually appropriate for 1-CPU/2GBDEFAULT_BATCH_SIZE from 100 to 25 and make configurableSTALE_QUEUE_TIMEOUT from 10 to 5 minutes