From 8cb9885a335eb893d2134290741f93cd3abe7999 Mon Sep 17 00:00:00 2001 From: Wedge Date: Sun, 5 Jan 2020 20:23:59 +0300 Subject: [PATCH] Possibly fix dependent projects --- app/controllers/projects/build_lists_controller.rb | 7 +++---- app/jobs/build_lists/dependent_packages_job.rb | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index 89af52b40..9c3f14c1d 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -104,9 +104,8 @@ class Projects::BuildListsController < Projects::BaseController project_ids = prs[:projects].select{ |k, v| v == '1' }.keys arch_ids = prs[:arches]. select{ |k, v| v == '1' }.keys - Sidekiq::Client.push( - 'class' => BuildLists::DependentPackagesJob, - 'args' => [@build_list.id, + BuildLists::DependentPackagesJob.perform_async( + @build_list.id, current_user.id, project_ids, arch_ids, @@ -116,7 +115,7 @@ class Projects::BuildListsController < Projects::BaseController include_testing_subrepository: prs[:include_testing_subrepository], use_cached_chroot: prs[:use_cached_chroot], use_extra_tests: prs[:use_extra_tests] - }] + } ) flash[:notice] = t('flash.build_list.dependent_projects_job_added_to_queue') redirect_to build_list_path(@build_list) diff --git a/app/jobs/build_lists/dependent_packages_job.rb b/app/jobs/build_lists/dependent_packages_job.rb index 485a96d58..438d6916c 100644 --- a/app/jobs/build_lists/dependent_packages_job.rb +++ b/app/jobs/build_lists/dependent_packages_job.rb @@ -1,6 +1,6 @@ module BuildLists class DependentPackagesJob - #sidekiq_options :queue => :middle + sidekiq_options :queue => :middle def perform(build_list_id, user_id, project_ids, arch_ids, options) build_list = BuildList.find(build_list_id) @@ -10,7 +10,7 @@ module BuildLists return unless BuildListPolicy.new(user, build_list).show? arches = Arch.where(id: arch_ids).to_a - Project.where(id: project_ids).to_a.each do |project| + Project.where(id: project_ids).find_each do |project| next unless ProjectPolicy.new(user, project).write? build_for_platform = save_to_platform = build_list.build_for_platform @@ -57,4 +57,4 @@ module BuildLists end end -end \ No newline at end of file +end