Class: Silas::ScheduleJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/silas/schedule_job.rb

Overview

The recurring entry Solid Queue fires enqueues this thin job, which resolves the schedule by name and triggers it. A tick is fire-and-forget: it never retry-loops (a failed tick shouldn't pile up), and the turn it starts is itself fully durable from :prepare onward.

Instance Method Summary collapse

Instance Method Details

#perform(schedule_name) ⇒ Object



13
14
15
16
17
18
19
20
# File 'app/jobs/silas/schedule_job.rb', line 13

def perform(schedule_name)
  schedule = Silas.schedules.find { |s| s.name == schedule_name }
  unless schedule
    Rails.logger&.warn("silas: no schedule #{schedule_name.inspect} (stale recurring entry? run `bin/rails silas:schedules`)")
    return
  end
  schedule.trigger!
end