Skip to content

Instantly share code, notes, and snippets.

@lulalala
Created April 18, 2017 07:36
Show Gist options
  • Save lulalala/5a794bb94ed9ea316e43166b5405584f to your computer and use it in GitHub Desktop.
Save lulalala/5a794bb94ed9ea316e43166b5405584f to your computer and use it in GitHub Desktop.
foo.with_lock do
# insert a
bar.with_lock do
# Mysql2::Error: Lock wait timeout exceeded
end
end
@lulalala
Copy link
Author

lulalala commented Apr 18, 2017

@insert a was not rolled back somehow, but I can't replicate it.

@godfat
Copy link

godfat commented Apr 18, 2017

according to the doc, you need to raise ActiveRecord::Rollback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment