0

Rails Guide and lots of other tutorials show me how to rescue ActiveRecord::StaleObjectError exception and do retry in optimistic locking. And I just curious can I do the same thing in pessimistic locking scenario.

Any reply is appreciate! :D

gurugurusa
  • 45
  • 1
  • 6
  • Can you be more specific about what you mean by "do the same thing in pessimistic locking scenario?" By definition, Rails won't throw that exception if you're using pessimistic locking. – Lencho Reyes Nov 08 '16 at 04:46
  • thanks, i see that it is hardly to catch that error ```Mysql2::Error: Lock wait timeout exceeded``` and do retry as i expect, because that error is actually raised by mysql database rather than active record. – gurugurusa Nov 10 '16 at 11:25
  • I think I see what you were asking now. It sounds like you've figured out what you have to do. Let me know if you have further questions about this. – Lencho Reyes Nov 11 '16 at 16:34

0 Answers0