##
# wrap an api call in a timeout
def api_call_timeout
- SystemTimer.timeout_after(API_TIMEOUT) do
+ OSM::Timer.timeout(API_TIMEOUT) do
yield
end
rescue Timeout::Error
##
# wrap a web page in a timeout
def web_timeout
- SystemTimer.timeout_after(WEB_TIMEOUT) do
+ OSM::Timer.timeout(WEB_TIMEOUT) do
yield
end
rescue ActionView::TemplateError => ex
require 'RMagick'
require 'nokogiri'
+ if defined?(SystemTimer)
+ Timer = SystemTimer
+ else
+ require 'timeout'
+ Timer = Timeout
+ end
+
# The base class for API Errors.
class APIError < RuntimeError
def status