小编nve*_*rba的帖子

是否有可能让一个Unicorn子进程队列,而其余进程Web请求Heroku单个Dyno?

如果你在Heroku上的一个dyno上设置了Unicorn,那就说3个工人.是否有可能让2个子工作者处理Web请求,1个Unicorn子进行后台作业,例如resque队列或计划任务?

或者那是不合适的?


现在搞定了!

好的,所以使用下面的答案,我设法得到它来获取提示,但它首先需要一些修修补补.这对我有用.

Procfile

web: bundle exec unicorn_rails -p $PORT -c config/unicorn.rb
Run Code Online (Sandbox Code Playgroud)

unicorn.rb

worker_processes 2
preload_app true
timeout 30

@resque_pid = nil

before_fork do |server, worker|
  @resque_pid ||= spawn("bundle exec rake environment resque:work QUEUE=*")
end

after_fork do |server, worker|
  ActiveRecord::Base.establish_connection
end
Run Code Online (Sandbox Code Playgroud)

heroku unicorn resque ruby-on-rails-3.1

5
推荐指数
1
解决办法
1036
查看次数

标签 统计

heroku ×1

resque ×1

ruby-on-rails-3.1 ×1

unicorn ×1