我使用 rails 3.0.11
、ruby 1.9.3-p0
、nginx 1.0.4
和 unicorn 3.6.2
为我的项目。我有一个问题。
我必须在我的服务器上进行长期操作。大约需要 150 秒。在这种情况下没关系。
我已经在位置
设置了我的nginx配置
proxy_read_timeout 240;
proxy_send_timeout 240;
然后用命令设置我的unicorn.rb
文件
timeout 240
但我总是收到 502 bad gateway
错误。
我认为, unicorn 有问题。我得到了这个 unicorn 日志
E, [2012-05-21T11:52:21.052382 #30423] ERROR -- : worker=1 PID:30871 timeout (104.052329915s > 60s), killing
E, [2012-05-21T11:52:21.080378 #30423] ERROR -- : reaped #<Process::Status: pid 30871 SIGKILL (signal 9)> worker=1
I, [2012-05-21T11:52:21.105045 #30423] INFO -- : worker=1 spawning...
I, [2012-05-21T11:52:21.111148 #894] INFO -- : worker=1 spawned pid=894
I, [2012-05-21T11:52:21.111659 #894] INFO -- : Refreshing Gem list
你能帮帮我吗?任何帮助表示赞赏。谢谢。
最佳答案
从评论中复制答案以便从“未回答”过滤器中删除此问题:
I have never used this gem, but if you're doing this after 'deploy:restart', 'unicorn:reload' you need to restart unicorn, not only reload it. sudo /etc/init.d/unicorn restart and the timeout will be set. Reload and restart are two different things in unicorn.
~ 根据 Maurício Linhares 回答
关于ruby-on-rails - 设置 unicorn 超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10685600/