Rails +工头+工人挂服务器 [英] Rails + foreman + worker hangs server
问题描述
在我的本地计算机上,我试图启动我的Rails应用程序,并使用Foreman延迟了工作人员。我的Procfile看起来像这样:
web:bundle exec rails服务器-p $ PORT
worker:bundle exec rake作业:work
当我开始领班时,只会执行前两个Web请求。对于第三个请求,服务器挂起。第一个请求在控制台中输出,第二个则没有。
如果我在Procfile中遗漏了工作进程,则服务器可以正常运行并将所有内容输出到控制台。另外,当我在没有Foreman的情况下启动Rails服务器和工作程序时,一切工作正常。我想这是Foreman在第一个请求后不向控制台输出任何内容的问题,因此不会刷新缓冲区。我搜索了其他帖子,结果将STDOUT.sync = true添加到我的development.rb,但没有成功。
有人知道吗?谢谢!
更新:
在这里跟踪并解决:
https://github.com/ddollar/foreman/issues/244
TL; DR:安装gem,不要使用foreman.pkg
我也遇到同样的问题。
这里是问题我已经问过stackoverflow了。 @smek,如果找到答案,请回复!
On my local machine I'm trying to start my rails app and delayed job worker using Foreman. My Procfile looks like this:
web: bundle exec rails server -p $PORT
worker: bundle exec rake jobs:work
When I start foreman only the first two web requests get executed. With the third request the server hangs. The first request is outputted in the console, the second isn't.
If I leave out the worker in my Procfile the server is running just fine and is outputting everything to the console. Also when I start the rails server and worker without Foreman everything is working fine.
So it looks like there's an issue with Foreman. I'm guessing it's a problem with Foreman not outputting anything to the console after the first request and therefore the buffer doesn't get flushed. I've searched other posts and as a result added STDOUT.sync = true to my development.rb but without any success.
Does anybody have a clue? Thanks!
UPDATE: Tracked and resolved here:
https://github.com/ddollar/foreman/issues/244
TL;DR: Install the gem, don't use foreman.pkg
I'm facing the same problem.
Here's a link to the question I've asked on stackoverflow. @smek, if you found an answer, please reply!
这篇关于Rails +工头+工人挂服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!