This commit is contained in:
Vokhmin Alexey V 2014-02-26 01:51:11 +04:00
parent c54225ec03
commit 092bc10b2c
2 changed files with 7 additions and 7 deletions

View File

@ -8,6 +8,12 @@ require 'resque_scheduler/tasks'
# This fixes connection fail with Postgres server on new fork:
task "resque:setup" => :environment do
require 'resque'
require 'resque-scheduler'
Resque.after_fork do
Resque.redis.client.reconnect
Resque.schedule = YAML.load_file(File.join(Rails.root, 'config/resque_schedule.yml')) # load the schedule
end
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
end

View File

@ -10,12 +10,6 @@ Resque::Mailer.excluded_environments = [:test]
unless Rails.env.test?
PerformLater.config.enabled = true # this will default to false if unset
Resque.schedule = YAML.load_file(File.join(Rails.root, 'config/resque_schedule.yml')) # load the schedule
end
Resque::Plugins::Status::Hash.expire_in = (24 * 60 * 60) # 24hrs in seconds
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
Resque.after_fork do
Resque.redis.client.reconnect
end