Skip to content

Instantly share code, notes, and snippets.

@lulalala
Created April 18, 2017 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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
@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