X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d6f8302eaeac711f8738c956f46c92de9743fed3..85f627c5c2d759046f159e4017ea799d92442178:/app/controllers/application_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1d6865405..87be14e5b 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 @@ -286,7 +289,7 @@ class ApplicationController < ActionController::Base append_content_security_policy_directives( :child_src => %w[http://127.0.0.1:8111 https://127.0.0.1:8112], :frame_src => %w[http://127.0.0.1:8111 https://127.0.0.1:8112], - :connect_src => [Settings.nominatim_url, Settings.overpass_url, Settings.fossgis_osrm_url, Settings.graphhopper_url], + :connect_src => [Settings.nominatim_url, Settings.overpass_url, Settings.fossgis_osrm_url, Settings.graphhopper_url, Settings.fossgis_valhalla_url], :form_action => %w[render.openstreetmap.org], :style_src => %w['unsafe-inline'] )