Sha256: ef7a6cc396d27646e808bd0deba5f2557cd4ff741df2dbb27b042ae187371a30
Contents?: true
Size: 980 Bytes
Versions: 4
Compression:
Stored size: 980 Bytes
Contents
module Slowpoke class Railtie < Rails::Railtie config.slowpoke = ActiveSupport::OrderedOptions.new # must happen outside initializer (so it runs earlier) config.action_dispatch.rescue_responses.merge!( "Rack::Timeout::RequestTimeoutError" => :service_unavailable, "Rack::Timeout::RequestExpiryError" => :service_unavailable ) initializer "slowpoke" do |app| service_timeout = app.config.slowpoke.timeout service_timeout ||= ENV["RACK_TIMEOUT_SERVICE_TIMEOUT"] || ENV["REQUEST_TIMEOUT"] || ENV["TIMEOUT"] || 15 if service_timeout.respond_to?(:call) app.config.middleware.insert_after ActionDispatch::DebugExceptions, Slowpoke::Timeout, service_timeout: service_timeout else app.config.middleware.insert_after ActionDispatch::DebugExceptions, Rack::Timeout, service_timeout: service_timeout.to_i end app.config.middleware.insert(0, Slowpoke::Middleware) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
slowpoke-0.6.0 | lib/slowpoke/railtie.rb |
slowpoke-0.5.0 | lib/slowpoke/railtie.rb |
slowpoke-0.4.0 | lib/slowpoke/railtie.rb |
slowpoke-0.3.2 | lib/slowpoke/railtie.rb |