所以我正在做一個API的調用,保持超時,即使我設置超時1000秒超時30後,我的實現是可能是錯的。獲取`在rbuf_fill'救援:超時::錯誤使用httparty與紅寶石中間人
require 'HTTParty'
require 'json'
class Api
include HTTParty
default_timeout 1000
@@Json
def initialize(api_root_url, code)
response = HTTParty.get("#{api_root_url}/api/page/"+code)
@@Json = JSON.parse(response.body)
end
end
錯誤
/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:146:in rescue in rbuf_fill': Timeout::Error (Timeout::Error) from .rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:140:in
從.rbenv /版本rbuf_fill」 /1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:122:in readuntil' from .rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:132:in
readline' from .rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2562:read_status_line' from .rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2551:in
read_new' from .rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1319:block in transport_request' from .rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1316:in
catch' from .rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1316:在transport_request' from .rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1293:in
請求' from .rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1286:block in request' from .rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:745:in
從.rbenv/versions/1.9.3-p194/lib開始' /ruby/1.9.1/net/http.rb:1284:in'請求」
在此先感謝