Class: StepperMotor::RecoverStuckJourneysJob
- Defined in:
- lib/stepper_motor/recover_stuck_journeys_job.rb
Overview
The purpose of this job is to find journeys which have, for whatever reason, remained in the
performing
state for far longer than the journey is supposed to. At the moment it assumes
any journey that stayed in performing
for longer than 1 hour has hung. Add this job to your
cron table and perform it regularly.
Constant Summary collapse
- DEFAULT_STUCK_FOR =
2.days
Instance Method Summary collapse
Instance Method Details
#perform(stuck_for: DEFAULT_STUCK_FOR) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/stepper_motor/recover_stuck_journeys_job.rb', line 10 def perform(stuck_for: DEFAULT_STUCK_FOR) StepperMotor::Journey.stuck(stuck_for.ago).find_each do |journey| journey.recover! rescue => e Rails.try(:error).try(:report, e) end end |