I have installed rack-timeout gem and created rack_timeout.rb inside the initializers.I have set Rack::Timeout.service_timeout = 1 inside rack_timeout.rb.I want to restrict the rack-timeout to halt the execution if timeout exceeded in controllers other than controllers inside api.Only the api controllers' execution should be stopped.I have created a custom middleware inside lib named my_middleware.rb
class MyMiddleware < Rack::Timeout
def initialize(app, options = {})
@app = app
@exclude = options[:exclude]
end
def call(env)
if env['PATH_INFO'].include? "api"
super(env)
else
@app.call(env)
end
end
end
config/development.rb
config.middleware.use "MyMiddleware"
but its not working.everywhere rack timeout is throwing the exception when timeout happened.