lib/rocket_job/batch/state_machine.rb in rocketjob-5.1.1 vs lib/rocket_job/batch/state_machine.rb in rocketjob-5.2.0.beta1

- old
+ new

@@ -1,6 +1,6 @@ -require 'active_support/concern' +require "active_support/concern" module RocketJob module Batch # State machine for sliced jobs module StateMachine @@ -21,19 +21,19 @@ # Replace existing event and all callbacks for that event aasm.state_machine.add_event(:requeue, {}) do # Requeue perform transitions from: :running, to: :running, - if: -> server_name { sub_state == :processing }, + if: ->(_server_name) { sub_state == :processing }, after: :rocket_job_requeue_sub_state_processing # Requeue after_batch transitions from: :running, to: :running, - if: -> server_name { worker_on_server?(server_name) && (sub_state == :after) }, + if: ->(server_name) { worker_on_server?(server_name) && (sub_state == :after) }, after: :rocket_job_requeue_sub_state_after # Requeue before_batch transitions from: :running, to: :queued, - if: -> server_name { worker_on_server?(server_name) && (sub_state == :before) }, + if: ->(server_name) { worker_on_server?(server_name) && (sub_state == :before) }, after: :rocket_job_requeue_sub_state_before end # Needed again here since the events have been overwritten above before_retry :rocket_job_clear_exception @@ -66,11 +66,11 @@ def rocket_job_processing? running? && (sub_state == :processing) end def rocket_job_sub_state_before - self.sub_state = :before unless self.sub_state + self.sub_state = :before unless sub_state end def rocket_job_clear_sub_state self.sub_state = nil end @@ -94,9 +94,8 @@ # Also retry failed slices when the job itself is re-tried def rocket_job_requeue_failed_slices input.requeue_failed end - end end end