Remove more unused code

This commit is contained in:
Wedge 2016-03-21 19:52:11 +03:00
parent 9ea4b1e2f3
commit ac379fce04
3 changed files with 0 additions and 64 deletions

View File

@ -92,7 +92,6 @@ module AbfWorker
else
Redis.current.lpush RESTARTED_BUILD_LISTS, subject.id
subject.update_column(:status, BuildList::BUILD_PENDING)
subject.restart_job if subject.external_nodes.blank?
return true
end
end

View File

@ -559,50 +559,6 @@ class BuildList < ActiveRecord::Base
)
end
def self.next_build(arch_ids, platform_ids)
build_list = next_build_from_queue(USER_BUILDS_SET, arch_ids, platform_ids)
build_list ||= next_build_from_queue(MASS_BUILDS_SET, arch_ids, platform_ids)
build_list.delayed_add_job_to_abf_worker_queue if build_list
build_list
end
def self.next_build_from_queue(set, arch_ids, platform_ids)
kind_id = Redis.current.spop(set).to_i
key =
case set
when USER_BUILDS_SET
"user_build_#{kind_id}_rpm_worker_default"
when MASS_BUILDS_SET
"mass_build_#{kind_id}_rpm_worker"
end if kind_id
task = Resque.pop(key) if key
if task || Redis.current.llen("resque:queue:#{key}") > 0
Redis.current.sadd(set, kind_id.to_s)
end
build_list = BuildList.where(id: task['args'][0]['id']).first if task
return unless build_list
if platform_ids.present? && platform_ids.exclude?(build_list.build_for_platform_id)
build_list.restart_job
return
end
if arch_ids.present? && arch_ids.exclude?(build_list.arch_id)
build_list.restart_job
return
end
build_list
end
def delayed_add_job_to_abf_worker_queue(*args)
restart_job if valid? && status == BUILD_PENDING
end
later :delayed_add_job_to_abf_worker_queue, delay: 60, queue: :middle
def valid_branch_for_publish?
@valid_branch_for_publish ||= begin
save_to_platform.personal? ||

View File

@ -22,7 +22,6 @@ module AbfWorkerMethods
end
def add_job_to_abf_worker_queue
update_build_sets
Resque.push(
worker_queue_with_priority,
'class' => worker_queue_class,
@ -30,12 +29,6 @@ module AbfWorkerMethods
)
end
def restart_job
update_build_sets
Redis.current.rpush "resque:queue:#{worker_queue_with_priority}",
Resque.encode({'class' => worker_queue_class, 'args' => [abf_worker_args]})
end
def cancel_job
if destroy_from_resque_queue == 1
build_canceled
@ -75,18 +68,6 @@ module AbfWorkerMethods
private
def update_build_sets
return unless is_a?(BuildList)
key = mass_build_id ? MASS_BUILDS_SET : USER_BUILDS_SET
Redis.current.pipelined do
Redis.current.sadd key, mass_build_id || user_id
Redis.current.sadd 'resque:queues', worker_queue_with_priority
end
end
def send_stop_signal
Redis.current.setex(
"#{service_queue}::live-inspector",