diff --git a/app/controllers/api/v1/jobs_controller.rb b/app/controllers/api/v1/jobs_controller.rb index 3df3a230e..613e1cda0 100644 --- a/app/controllers/api/v1/jobs_controller.rb +++ b/app/controllers/api/v1/jobs_controller.rb @@ -15,10 +15,13 @@ class Api::V1::JobsController < Api::V1::BaseController build_lists = build_lists.for_platform(platform_ids) if platform_ids.present? if current_user.system? - # Temporally - # if task = Resque.pop('rpm_worker') if task = (Resque.pop('rpm_worker_default') || Resque.pop('rpm_worker')) @build_list = BuildList.where(:id => task['args'][0]['id']).first + # Temporally + if @build_list.build_for_platform.name == 'red3' + @build_list.restart_job + @build_list = nil + end end end diff --git a/lib/abf_worker/model_helper.rb b/lib/abf_worker/model_helper.rb index d39e525f1..9aa000095 100644 --- a/lib/abf_worker/model_helper.rb +++ b/lib/abf_worker/model_helper.rb @@ -28,6 +28,12 @@ module AbfWorker::ModelHelper ) end + def restart_job + redis = Resque.redis + redis.lpush "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 diff --git a/lib/abf_worker/rpm_worker_observer.rb b/lib/abf_worker/rpm_worker_observer.rb index e84fcdd37..3e9201f1c 100644 --- a/lib/abf_worker/rpm_worker_observer.rb +++ b/lib/abf_worker/rpm_worker_observer.rb @@ -59,7 +59,7 @@ module AbfWorker else redis.lpush RESTARTED_BUILD_LISTS, subject.id subject.update_column(:status, BuildList::BUILD_PENDING) - subject.add_job_to_abf_worker_queue if subject.external_nodes.blank? + subject.restart_job if subject.external_nodes.blank? return true end end