我正在使用heroku託管支持iOS應用程序的Rails應用程序的ruby。我有一個可能運行很久的請求,我需要能夠在我的請求被終止之前趕上超時。我使用Timeout :: timeout(15)來引發錯誤並正確處理它。這在我的本地工作正常,我可以看到錯誤被拋出和記錄。當我在heroku上運行相同的代碼時,不會記錄錯誤。嘗試使用機架超時寶石時,我遇到了同樣的問題。Heroku超時::超時不會引發錯誤
是否有其他人遇到超時在Heroku上運行的問題?我在雪松。
我正在使用heroku託管支持iOS應用程序的Rails應用程序的ruby。我有一個可能運行很久的請求,我需要能夠在我的請求被終止之前趕上超時。我使用Timeout :: timeout(15)來引發錯誤並正確處理它。這在我的本地工作正常,我可以看到錯誤被拋出和記錄。當我在heroku上運行相同的代碼時,不會記錄錯誤。嘗試使用機架超時寶石時,我遇到了同樣的問題。Heroku超時::超時不會引發錯誤
是否有其他人遇到超時在Heroku上運行的問題?我在雪松。
# app/controllers/index_controller.rb
require 'timeout'
Class IndexController < ApplicationController
def timeout
begin
status = Timeout::timeout(5) {
sleep(6)
render :text => "will never be rendered"
rescue Timeout::Error
render :text => "timeout handled"
end
end
end
end
# config/routes.rb
match '/timeout' => "index#timeout"
這工作正常,在Heroku:http://young-gorge-7585.herokuapp.com
看看使用機架::超時,專爲這個目的。
是的我有完全相同的問題,非常討厭! – andy