ruby rest-client:使其永不超时?

2024-04-05

我正在尝试使用红宝石休息客户端 https://github.com/archiloque/rest-client/将大量图像上传到我正在编写的网站。我的代码如下所示:

RestClient.post url, :timeout => 90000000, :open_timeout => 90000000, :file_param => file_obj

但是,我收到此错误:

RestClient::RequestTimeout: Request Timeout
    from /Library/Ruby/Gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:174:in `transmit'
    from /Library/Ruby/

但是当我查看服务器日志时

Completed in 61493ms (View: 2, DB: 1) | 201 Created 

因此,似乎没有任何理由导致超时。有人知道我是否未正确设置超时参数吗?

Thanks


此语法将超时设置为请求标头(请参阅 RestClient.post 签名),如果您想使用超时参数,则必须使用:

RestClient::Request.execute(:method => :post, :url => @url, :timeout => 90000000)

see: https://github.com/rest-client/rest-client/blob/master/lib/restclient/request.rb#L12 https://github.com/rest-client/rest-client/blob/master/lib/restclient/request.rb#L12

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ruby rest-client:使其永不超时? 的相关文章

随机推荐