lib/rocket_job/plugins/state_machine.rb in rocketjob-3.0.0.rc5 vs lib/rocket_job/plugins/state_machine.rb in rocketjob-3.0.0
- old
+ new
@@ -29,9 +29,13 @@
module StateMachine
extend ActiveSupport::Concern
included do
include AASM
+ # Try to make aasm lookup thread safe
+ @aasm = Concurrent::Map.new
+ # Call aasm to create default instance upfront
+ aasm
# Adds a :before or :after callback to an event
# state_machine_add_event_callback(:start, :before, :my_method)
def self.state_machine_add_event_callback(event_name, action, *methods, &block)
raise(ArgumentError, 'Cannot supply both a method name and a block') if (methods.size > 0) && block