raise OSM::APIBadMethodError.new(method) unless ok
end
+ ##
+ # wrap an api call in a timeout
def api_call_timeout
SystemTimer.timeout_after(APP_CONFIG['api_timeout']) do
yield
raise OSM::APITimeoutError
end
+ ##
+ # wrap a web page in a timeout
+ def web_timeout
+ SystemTimer.timeout_after(APP_CONFIG['web_timeout']) do
+ yield
+ end
+ rescue ActionView::TemplateError => ex
+ if ex.original_exception.is_a?(Timeout::Error)
+ render :action => "timeout"
+ else
+ raise
+ end
+ rescue Timeout::Error
+ render :action => "timeout"
+ end
+
##
# extend caches_action to include the parameters, locale and logged in
# status in all cache keys
before_filter :authorize_web
before_filter :set_locale
before_filter { |c| c.check_database_readable(true) }
- around_filter :timeout, :except => [:start]
+ around_filter :web_timeout, :except => [:start]
def start
end
rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found
end
-
-private
-
- def timeout
- SystemTimer.timeout_after(30) do
- yield
- end
- rescue ActionView::TemplateError => ex
- if ex.original_exception.is_a?(Timeout::Error)
- render :action => "timeout"
- else
- raise
- end
- rescue Timeout::Error
- render :action => "timeout"
- end
end
before_filter :check_api_writable, :only => [:create, :update, :delete, :upload, :include]
before_filter :check_api_readable, :except => [:create, :update, :delete, :upload, :download, :query]
after_filter :compress_output
- around_filter :api_call_handle_error
+ around_filter :api_call_handle_error, :except => [:list, :list_user, :list_bbox]
+ around_filter :web_timeout, :only => [:list, :list_user, :list_bbox]
filter_parameter_logging "<osmChange version"
--- /dev/null
+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 })),
+ "xmlns:georss" => "http://www.georss.org/georss") do |feed|
+ feed.title @title
+
+ feed.subtitle :type => 'xhtml' do |xhtml|
+ xhtml.p do |p|
+ p << t('changeset.timeout.sorry')
+ end
+ end
+end
--- /dev/null
+<p><%= t'changeset.timeout.sorry' %></p>
geonames_zoom: 12
# Timeout for API calls in seconds
api_timeout: 300
+ # Timeout for web pages in seconds
+ web_timeout: 30
# Periods (in hours) which are allowed for user blocks
user_block_periods: [0, 1, 3, 6, 12, 24, 48, 96]
# Rate limit for message sending
description_user: "Changesets by {{user}}"
description_bbox: "Changesets within {{bbox}}"
description_user_bbox: "Changesets by {{user}} within {{bbox}}"
+ timeout:
+ sorry: "Sorry, the list of changesets you requested took too long to retrieve."
diary_entry:
new:
title: New Diary Entry