[openstreetmap/openstreetmap-website] Fix timeout messages for former browse pages (PR #4617)

Tom Hughes notifications at github.com
Wed Apr 3 17:18:30 UTC 2024


@tomhughes commented on this pull request.



> @@ -206,13 +206,13 @@ def web_timeout(&block)
     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"
+      render "browse/timeout", :layout => map_layout

I know you change it again later but I don't think it's reasonable to have this as an intermediate step as it leaves the site broken - the while point of only setting an action was to render the timeout action for the current controller because timeouts can occur in different controllers.

I think this needs more though about how to do this change and the following one to ensure we keep things roughly working through each step.

> @@ -11,7 +11,7 @@ class NotesController < ApplicationController
 
   before_action :lookup_user, :only => [:index]
   before_action :set_locale
-  around_action :web_timeout
+  around_action :web_timeout, :only => :show

Why are we removing this from the index action - the timeouts are an important protection against users finding a way to trigger expensive database queries and list/search methods like index are a key danger there.

> @@ -1,6 +1,6 @@
 atom_feed(:language => I18n.locale, :schema_date => 2009,
-          :id => url_for(params.merge(:only_path => false)),
-          :root_url => url_for(params.merge(:only_path => false, :format => nil)),
+          :id => url_for(params.permit(:format, :display_name, :bbox, :friends, :nearby).merge(:only_path => false)),
+          :root_url => url_for(params.permit(:format, :display_name, :bbox, :friends, :nearby).merge(:action => :index, :format => nil, :only_path => false)),

We should probably factor out the `params.permit` into a variable to avoid duplicating it?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4617#pullrequestreview-1977460715
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/4617/review/1977460715 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240403/01184695/attachment-0001.htm>


More information about the rails-dev mailing list