Possibly fix dependent projects

This commit is contained in:
Wedge 2020-01-05 20:23:59 +03:00
parent be9508fc56
commit 8cb9885a33
2 changed files with 6 additions and 7 deletions

View File

@ -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)

View File

@ -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