Ruby 线程超时的合理时间长度是多少?
我需要保留数据并让 Ruby 程序等待几天的响应。我正在考虑使用线程来实现这一点(网络上可能有许多并发请求)。我的问题;让线程运行几天以等待响应是否合理?
I've got a need to retain the data and keep a Ruby program waiting for a response for anything up to a couple of days. I'm thinking about implementing this using threads (there may be a number of concurrent requests across a network). My question; is it reasonable to leave a thread running for anything up to a couple of days awaiting a response?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,这是没有问题的。查看 Queue 类,它可能有助于“作业轮询”:
http://www.ruby-doc.org/stdlib-1.8.7/libdoc/thread/rdoc/Queue.html
In general there is no problem with that. Check out the Queue class, it might facilitate the "job polling":
http://www.ruby-doc.org/stdlib-1.8.7/libdoc/thread/rdoc/Queue.html