This commit is contained in:
Vokhmin Alexey V 2014-02-27 00:50:39 +04:00
parent db3ba727e9
commit f8ba1d05a0
5 changed files with 24 additions and 30 deletions

View File

@ -320,7 +320,7 @@ GEM
rdoc (3.12.2)
json (~> 1.4)
redcarpet (2.2.2)
redis (3.0.6)
redis (3.0.7)
redis-actionpack (3.2.4)
actionpack (~> 3.2.0)
redis-rack (~> 1.4.4)
@ -349,7 +349,7 @@ GEM
redis-namespace (~> 1.2)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
resque-scheduler (2.5.3)
resque-scheduler (2.5.4)
redis (~> 3.0.4)
resque (~> 1.25.1)
rufus-scheduler (~> 2.0.24)

View File

@ -6,13 +6,4 @@ require 'rake'
require 'resque/tasks'
require 'resque_scheduler/tasks'
# This fixes connection fail with Postgres server on new fork:
task "resque:setup" => :environment do
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
Rosa::Application.load_tasks

View File

@ -527,7 +527,6 @@ class BuildList < ActiveRecord::Base
end
def self.next_build
unless task = (Resque.pop('rpm_worker_default') || Resque.pop('rpm_worker'))
redis = Resque.redis
kind_id = redis.spop(USER_BUILDS_SET)
key = "user_build_#{kind_id}_rpm_worker_default" if kind_id
@ -539,7 +538,6 @@ class BuildList < ActiveRecord::Base
key ||= "mass_build_#{kind_id}_rpm_worker" if kind_id
task ||= Resque.pop(key) if key
redis.sadd(MASS_BUILDS_SET, kind_id) if task && key =~ /^mass_build/
end
if task
build_list = BuildList.where(id: task['args'][0]['id']).first

View File

@ -26,14 +26,6 @@ every :day, at: '3:00 am' do
rake 'activity_feeds:clear', output: 'log/activity_feeds.log'
end
every 3.minute do
runner 'AbfWorker::BuildListsPublishTaskManager.new.run', output: 'log/task_manager.log'
end
every 1.minute do
runner 'RpmBuildNode.cleanup!'
end
every 1.hour do
rake 'buildlist:clear:outdated_canceling', output: 'log/canceling_build_list_clear.log'
end

View File

@ -7,4 +7,17 @@ namespace :resque do
end
system("kill -QUIT #{pids.join(' ')}") if pids.size > 0
end
# This fixes connection fail with Postgres server on new fork:
task setup: :environment do
Resque.after_fork do
Resque.redis.client.reconnect
end
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
end
task scheduler_setup: :environment do
Resque.schedule = YAML.load_file(Rails.root.join('config', 'resque_schedule.yml'))
end
end