Class: SourceMonitor::FetchFeedJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/source_monitor/fetch_feed_job.rb

Constant Summary collapse

FETCH_CONCURRENCY_BASE_WAIT =
30.seconds
FETCH_CONCURRENCY_MAX_WAIT =
5.minutes
EARLY_EXECUTION_LEEWAY =
30.seconds
SCHEDULED_CONCURRENCY_MAX_ATTEMPTS =
5

Instance Method Summary collapse

Methods inherited from ApplicationJob

source_monitor_queue

Instance Method Details

#perform(source_id, force: false) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/jobs/source_monitor/fetch_feed_job.rb', line 19

def perform(source_id, force: false)
  @source_id = source_id
  @force = force

  source = SourceMonitor::Source.find_by(id: source_id)
  return unless source

  @source = source
  return unless should_run?(source, force: force)

  SourceMonitor::Fetching::FetchRunner.new(source: source, force: force).run
rescue SourceMonitor::Fetching::FetchError => error
  handle_transient_error(source, error)
end