Class: StepperMotor::PerformStepJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/stepper_motor/perform_step_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(journey_gid) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/stepper_motor/perform_step_job.rb', line 4

def perform(journey_gid)
  # Pass the GlobalID instead of the record itself, so that we can rescue the non-existing record
  # exception here as opposed to the job deserialization
  journey = begin
    GlobalID::Locator.locate(journey_gid)
  rescue ActiveRecord::RecordNotFound
    return # The journey has been canceled and destroyed previously or elsewhere
  end
  journey.perform_next_step!
end