开发者

What is the current status of Timeout::timeout in JRuby? Is it reliable?

jruby-lint reports the use of Timeout::timeout as a potential source of problems:

   ./app/models/xyz.rb:273: [timeout, warning] Timeout in JRuby does not work in many cases

But googling that warning seems to show that most of the bugs reported are already fixed or apply to very specific cases. Moreover, it looks like JRuby's implementation of Timeout::timeout is more reliable and performant than MRI's implementation. Is it so?

I am using it to handle timeouts in Net::HTTP requests, which is a fairly common use case, so I guess that if it didn't work I would find open bugs reported. Ca开发者_开发百科n I disregard jrlint's warning?


timeout in jruby 1.5+ should be much better than it was in older versions, as it is now implemented natively in JRuby (see https://github.com/jruby/jruby/commits/master/src/org/jruby/ext/Timeout.java) vs the old ruby implementation that was indeed pretty broken.

Looking at the history, there have been some bug fixes related to net/http since 1.5, so use 1.6+ for best results.

So I'd say, yes, you can disregard that warning.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜