diff --git a/app/jobs/abf_worker/rpm_worker_observer.rb b/app/jobs/abf_worker/rpm_worker_observer.rb index 018d91b7b..033474851 100644 --- a/app/jobs/abf_worker/rpm_worker_observer.rb +++ b/app/jobs/abf_worker/rpm_worker_observer.rb @@ -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 diff --git a/app/models/build_list.rb b/app/models/build_list.rb index d6aece6b3..6a921a27f 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -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? || diff --git a/app/models/concerns/abf_worker_methods.rb b/app/models/concerns/abf_worker_methods.rb index 5f5b2442f..bfe76de54 100644 --- a/app/models/concerns/abf_worker_methods.rb +++ b/app/models/concerns/abf_worker_methods.rb @@ -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",