让异步http请求在rails 3beta4/ruby 1.9.2-rc2/thin/eventmachine上工作
我一直在尝试在我的应用程序中使用基本的异步 HTTP 调用。
我尝试在我的应用程序中使用 Rails 3 异步堆栈演示中的一些代码: http://github.com /igrigorik/async-rails,但我得到“无法从根纤维产生”,我不知道从这里去哪里。这是我的跟踪的顶部:
(eval):10:in `yield'
(eval):10:in `get'
app/controllers/home_controller.rb:62:in `index'
/Users/ct/.rvm/gems/ruby-1.9.2-rc2@og/gems/actionpack-3.0.0.beta4/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/Users/ct/.rvm/gems/ruby-1.9.2-rc2@og/gems/actionpack-3.0.0.beta4/lib/abstract_controller/base.rb:145:in `process_action'
我的索引控制器方法很简单:
def index
http = EM::HttpRequest.new("http://www.google.com/").get
render :text => http.response
end
我有所有正确的 gem,我有 1.9.2-rc2,rails 3 beta 4,而且我正在运行。我还让 async-rails 应用程序本身使用相同的 rvm 和 gemset 运行良好。 eventmachine 反应器肯定在我的应用程序中运行。我希望得到有关如何使其正常工作的任何提示!
I've been trying to get basic async HTTP calls to work in my app.
I've tried using some code in my app from the Rails 3 async stack demo: http://github.com/igrigorik/async-rails, but I'm getting "can't yield from root fiber" and I have no idea where to go from here. Here's the top of my trace:
(eval):10:in `yield'
(eval):10:in `get'
app/controllers/home_controller.rb:62:in `index'
/Users/ct/.rvm/gems/ruby-1.9.2-rc2@og/gems/actionpack-3.0.0.beta4/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/Users/ct/.rvm/gems/ruby-1.9.2-rc2@og/gems/actionpack-3.0.0.beta4/lib/abstract_controller/base.rb:145:in `process_action'
my index controller method is simply:
def index
http = EM::HttpRequest.new("http://www.google.com/").get
render :text => http.response
end
I've got all the right gems, I've got 1.9.2-rc2, rails 3 beta 4, and I'm running thin. I also got the async-rails app itself to run fine using the same rvm and gemset. The eventmachine reactor is definitely running in my app. I'd love any hints about how to get this working properly!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论