I'm trying to use the rack-timeout gem on Rails. I added the line gem 'rack-timeout'
to my Gemfile and ran bundle install
. (It shows Using rack-timeout (0.0.4)
) Then I submitted a request to my server. It clearly hung for more than 15 seconds without returning anything to me. What am I missing?
You need to tell Rails what to do when a Rack::Timeout error is thrown.
You could do something like this
class ApplicationController < ActionController::Base
rescue_from Timeout::Error, with: :handle_timeout
protected
def handle_timeout
render "shared/timeout"
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With