Skip to content

Commit

Permalink
Lock the parent row when transitioning
Browse files Browse the repository at this point in the history
This prevents deadlocks in some cases.
See #228 for more info.
This branch is only here to test the change.
  • Loading branch information
Harry Maclean committed May 16, 2017
1 parent 41b56ba commit 8134302
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/statesman/adapters/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def create_transition(from, to, metadata)

transition = transitions_for_parent.build(transition_attributes)

::ActiveRecord::Base.transaction do
@parent_model.with_lock do
@observer.execute(:before, from, to, transition)
unset_old_most_recent
transition.save!
Expand Down

0 comments on commit 8134302

Please sign in to comment.