i use rack-timeout , works fine. couldn't figure out how set time particular url.
even if like:
map '/foo/bar' rack::timeout.timeout = 10 end
not /foo/bar action every action dies after 10 second.
is possible set timeout particular url? or should use solution other rack-timeout?
if you're worried particular actions running long, wrap code of concern in timeout block instead of trying enforce timeouts on url level. wrap below helper method , use variable timeout throughout controllers.
require "timeout'" begin status = timeout::timeout(10) { # potentially long process here... } rescue timeout::error puts 'this taking way long.' end
Comments
Post a Comment