]> git.openstreetmap.org Git - rails.git/commit
Make API and web roll back any open transactions on timeout
authorMatt Amos <zerebubuth@gmail.com>
Fri, 2 Dec 2016 09:31:45 +0000 (09:31 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 2 Dec 2016 09:31:45 +0000 (09:31 +0000)
commit8b03371e106a52a20971cc8ab6535de93ece692e
tree36bd2fb5ea6411ecf1036c577099b70d39eb7310
parent160a328620b526a96b18ee04892e34aec3f6eb1f
Make API and web roll back any open transactions on timeout

By default the exception thrown by Timeout::timeout is caught
using Kernel::catch so that it cannot be stopped by intermediate
exception handlers. The problem with that is that it stops any
database transactions that were in progress being rolled back
because they never see the exception.

Fortunately passing a class to Timeout::timeout changes it's
behaviour so that the exception is thrown and caught in the normal
way, allowing the database transactions to rollback.
app/controllers/application_controller.rb