首先是几个期望。
你有一个config/resque_config.rb
或类似的:
require 'rubygems'
require 'resque' # include resque so we can configure it
require 'resque/server'
require 'resque_scheduler'
require 'resque_scheduler/server'
require 'yaml'
Resque.redis.namespace = "resque:api"
rails_root = ENV['APP_ROOT'] || (File.dirname(__FILE__) + '/..')
# require File.expand_path(File.join(rails_root,"lib","extensions","resque","worker.rb"))
rails_env = RAILS_ENV if defined? RAILS_ENV
rails_env ||= ( ENV['RAILS_ENV'] || 'development' )
resque_config = YAML.load_file(File.join(rails_root, 'config/resque.yml'))
Resque.redis = resque_config[rails_env]
# IN THIS ORDER
Resque::Scheduler.dynamic = true
Resque.schedule = YAML.load_file(File.join(rails_root, 'config/resque_schedule.yml')) # load the schedule
和一个config/resque.yml
或类似的:
development: localhost:6379
test: localhost:6379
integration: localhost:6379
staging: localhost:6379
production: localhost:6379
integration
要么打开/与不同的服务器通信,要么使用不同的端口。然后你让它运行它自己的 Redis 服务器,这样 2 就不会重叠。我想您不希望生产和集成将事物排队到同一个地方?