X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/13aead560185c3ec580b4cae70752a3afed7bb93..5be5155e03b9e7989d2c8d3d244511c0b9b13eb7:/app/controllers/application_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1d6865405..d3f57f086 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -231,6 +231,7 @@ class ApplicationController < ActionController::Base def api_call_timeout(&block) Timeout.timeout(Settings.api_timeout, Timeout::Error, &block) rescue Timeout::Error + ActiveRecord::Base.connection.raw_connection.cancel raise OSM::APITimeoutError end @@ -243,11 +244,13 @@ class ApplicationController < ActionController::Base if e.is_a?(Timeout::Error) || (e.is_a?(ActiveRecord::StatementInvalid) && e.message.include?("execution expired")) + ActiveRecord::Base.connection.raw_connection.cancel render :action => "timeout" else raise end rescue Timeout::Error + ActiveRecord::Base.connection.raw_connection.cancel render :action => "timeout" end