Cleanup
This commit is contained in:
parent
db3ba727e9
commit
f8ba1d05a0
|
@ -320,7 +320,7 @@ GEM
|
||||||
rdoc (3.12.2)
|
rdoc (3.12.2)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
redcarpet (2.2.2)
|
redcarpet (2.2.2)
|
||||||
redis (3.0.6)
|
redis (3.0.7)
|
||||||
redis-actionpack (3.2.4)
|
redis-actionpack (3.2.4)
|
||||||
actionpack (~> 3.2.0)
|
actionpack (~> 3.2.0)
|
||||||
redis-rack (~> 1.4.4)
|
redis-rack (~> 1.4.4)
|
||||||
|
@ -349,7 +349,7 @@ GEM
|
||||||
redis-namespace (~> 1.2)
|
redis-namespace (~> 1.2)
|
||||||
sinatra (>= 0.9.2)
|
sinatra (>= 0.9.2)
|
||||||
vegas (~> 0.1.2)
|
vegas (~> 0.1.2)
|
||||||
resque-scheduler (2.5.3)
|
resque-scheduler (2.5.4)
|
||||||
redis (~> 3.0.4)
|
redis (~> 3.0.4)
|
||||||
resque (~> 1.25.1)
|
resque (~> 1.25.1)
|
||||||
rufus-scheduler (~> 2.0.24)
|
rufus-scheduler (~> 2.0.24)
|
||||||
|
|
9
Rakefile
9
Rakefile
|
@ -6,13 +6,4 @@ require 'rake'
|
||||||
require 'resque/tasks'
|
require 'resque/tasks'
|
||||||
require 'resque_scheduler/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
|
Rosa::Application.load_tasks
|
||||||
|
|
|
@ -527,19 +527,17 @@ class BuildList < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.next_build
|
def self.next_build
|
||||||
unless task = (Resque.pop('rpm_worker_default') || Resque.pop('rpm_worker'))
|
redis = Resque.redis
|
||||||
redis = Resque.redis
|
kind_id = redis.spop(USER_BUILDS_SET)
|
||||||
kind_id = redis.spop(USER_BUILDS_SET)
|
key = "user_build_#{kind_id}_rpm_worker_default" if kind_id
|
||||||
key = "user_build_#{kind_id}_rpm_worker_default" if kind_id
|
task = Resque.pop(key) if key
|
||||||
task = Resque.pop(key) if key
|
redis.sadd(USER_BUILDS_SET, kind_id) if task
|
||||||
redis.sadd(USER_BUILDS_SET, kind_id) if task
|
|
||||||
|
|
||||||
|
|
||||||
kind_id ||= redis.spop(MASS_BUILDS_SET)
|
kind_id ||= redis.spop(MASS_BUILDS_SET)
|
||||||
key ||= "mass_build_#{kind_id}_rpm_worker" if kind_id
|
key ||= "mass_build_#{kind_id}_rpm_worker" if kind_id
|
||||||
task ||= Resque.pop(key) if key
|
task ||= Resque.pop(key) if key
|
||||||
redis.sadd(MASS_BUILDS_SET, kind_id) if task && key =~ /^mass_build/
|
redis.sadd(MASS_BUILDS_SET, kind_id) if task && key =~ /^mass_build/
|
||||||
end
|
|
||||||
|
|
||||||
if task
|
if task
|
||||||
build_list = BuildList.where(id: task['args'][0]['id']).first
|
build_list = BuildList.where(id: task['args'][0]['id']).first
|
||||||
|
|
|
@ -26,14 +26,6 @@ every :day, at: '3:00 am' do
|
||||||
rake 'activity_feeds:clear', output: 'log/activity_feeds.log'
|
rake 'activity_feeds:clear', output: 'log/activity_feeds.log'
|
||||||
end
|
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
|
every 1.hour do
|
||||||
rake 'buildlist:clear:outdated_canceling', output: 'log/canceling_build_list_clear.log'
|
rake 'buildlist:clear:outdated_canceling', output: 'log/canceling_build_list_clear.log'
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,4 +7,17 @@ namespace :resque do
|
||||||
end
|
end
|
||||||
system("kill -QUIT #{pids.join(' ')}") if pids.size > 0
|
system("kill -QUIT #{pids.join(' ')}") if pids.size > 0
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue