Fix browse elements timeouts

This commit is contained in:
Anton Khorev 2024-04-04 16:44:53 +03:00
parent 25dbc4d43e
commit ed74bc036b
13 changed files with 111 additions and 0 deletions

View file

@ -0,0 +1,5 @@
<% set_title(t("browse.timeout.title")) %>
<%= render "sidebar_header", :title => t("browse.timeout.title") %>
<p><%= t ".sorry", :id => params[:id] %></p>

View file

@ -0,0 +1,5 @@
<% set_title(t("browse.timeout.title")) %>
<%= render "sidebar_header", :title => t("browse.timeout.title") %>
<p><%= t ".sorry", :id => params[:id] %></p>

View file

@ -0,0 +1,5 @@
<% set_title(t("browse.timeout.title")) %>
<%= render "sidebar_header", :title => t("browse.timeout.title") %>
<p><%= t ".sorry", :id => params[:id] %></p>

View file

@ -0,0 +1,5 @@
<% set_title(t("browse.timeout.title")) %>
<%= render "sidebar_header", :title => t("browse.timeout.title") %>
<p><%= t ".sorry", :id => params[:id] %></p>

View file

@ -0,0 +1,5 @@
<% set_title(t("browse.timeout.title")) %>
<%= render "sidebar_header", :title => t("browse.timeout.title") %>
<p><%= t ".sorry", :id => params[:id] %></p>

View file

@ -0,0 +1,5 @@
<% set_title(t("browse.timeout.title")) %>
<%= render "sidebar_header", :title => t("browse.timeout.title") %>
<p><%= t ".sorry", :id => params[:id] %></p>

View file

@ -403,15 +403,30 @@ en:
introduction: "Click on the map to find nearby features." introduction: "Click on the map to find nearby features."
nearby: "Nearby features" nearby: "Nearby features"
enclosing: "Enclosing features" enclosing: "Enclosing features"
nodes:
timeout:
sorry: "Sorry, the data for the node with the id %{id}, took too long to retrieve."
old_nodes: old_nodes:
not_found: not_found:
sorry: "Sorry, node #%{id} version %{version} could not be found." sorry: "Sorry, node #%{id} version %{version} could not be found."
timeout:
sorry: "Sorry, the history of the node with the id %{id}, took too long to retrieve."
ways:
timeout:
sorry: "Sorry, the data for the way with the id %{id}, took too long to retrieve."
old_ways: old_ways:
not_found: not_found:
sorry: "Sorry, way #%{id} version %{version} could not be found." sorry: "Sorry, way #%{id} version %{version} could not be found."
timeout:
sorry: "Sorry, the history of the way with the id %{id}, took too long to retrieve."
relations:
timeout:
sorry: "Sorry, the data for the relation with the id %{id}, took too long to retrieve."
old_relations: old_relations:
not_found: not_found:
sorry: "Sorry, relation #%{id} version %{version} could not be found." sorry: "Sorry, relation #%{id} version %{version} could not be found."
timeout:
sorry: "Sorry, the history of the relation with the id %{id}, took too long to retrieve."
changeset_comments: changeset_comments:
feeds: feeds:
comment: comment:

View file

@ -90,4 +90,15 @@ class NodesControllerTest < ActionDispatch::IntegrationTest
assert_select ".secondary-actions a", :text => "View History", :count => 1 assert_select ".secondary-actions a", :text => "View History", :count => 1
assert_select ".secondary-actions a", :text => "View Unredacted History", :count => 1 assert_select ".secondary-actions a", :text => "View Unredacted History", :count => 1
end end
def test_show_timeout
node = create(:node)
with_settings(:web_timeout => -1) do
get node_path(node)
end
assert_response :error
assert_template :layout => "map"
assert_dom "h2", "Timeout Error"
assert_dom "p", /#{Regexp.quote("the node with the id #{node.id}")}/
end
end end

View file

@ -218,6 +218,17 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest
assert_select "#sidebar_content", /node #0 version 0 could not be found/ assert_select "#sidebar_content", /node #0 version 0 could not be found/
end end
def test_show_timeout
node = create(:node, :with_history)
with_settings(:web_timeout => -1) do
get old_node_path(node, 1)
end
assert_response :error
assert_template :layout => "map"
assert_dom "h2", "Timeout Error"
assert_dom "p", /#{Regexp.quote("the node with the id #{node.id}")}/
end
private private
def create_redacted_node def create_redacted_node

View file

@ -177,6 +177,17 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
assert_select "#sidebar_content", /relation #0 version 0 could not be found/ assert_select "#sidebar_content", /relation #0 version 0 could not be found/
end end
def test_show_timeout
relation = create(:relation, :with_history)
with_settings(:web_timeout => -1) do
get old_relation_path(relation, 1)
end
assert_response :error
assert_template :layout => "map"
assert_dom "h2", "Timeout Error"
assert_dom "p", /#{Regexp.quote("the relation with the id #{relation.id}")}/
end
private private
def create_redacted_relation def create_redacted_relation

View file

@ -182,6 +182,17 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest
assert_select "#sidebar_content", /way #0 version 0 could not be found/ assert_select "#sidebar_content", /way #0 version 0 could not be found/
end end
def test_show_timeout
way = create(:way, :with_history)
with_settings(:web_timeout => -1) do
get old_way_path(way, 1)
end
assert_response :error
assert_template :layout => "map"
assert_dom "h2", "Timeout Error"
assert_dom "p", /#{Regexp.quote("the way with the id #{way.id}")}/
end
private private
def create_redacted_way def create_redacted_way

View file

@ -36,4 +36,15 @@ class RelationsControllerTest < ActionDispatch::IntegrationTest
sidebar_browse_check :relation_path, member.id, "browse/feature" sidebar_browse_check :relation_path, member.id, "browse/feature"
assert_select "a[href='#{relation_path relation}']", :count => 1 assert_select "a[href='#{relation_path relation}']", :count => 1
end end
def test_show_timeout
relation = create(:relation)
with_settings(:web_timeout => -1) do
get relation_path(relation)
end
assert_response :error
assert_template :layout => "map"
assert_dom "h2", "Timeout Error"
assert_dom "p", /#{Regexp.quote("the relation with the id #{relation.id}")}/
end
end end

View file

@ -36,4 +36,15 @@ class WaysControllerTest < ActionDispatch::IntegrationTest
sidebar_browse_check :way_path, member.id, "browse/feature" sidebar_browse_check :way_path, member.id, "browse/feature"
assert_select "a[href='#{relation_path relation}']", :count => 1 assert_select "a[href='#{relation_path relation}']", :count => 1
end end
def test_show_timeout
way = create(:way)
with_settings(:web_timeout => -1) do
get way_path(way)
end
assert_response :error
assert_template :layout => "map"
assert_dom "h2", "Timeout Error"
assert_dom "p", /#{Regexp.quote("the way with the id #{way.id}")}/
end
end end