Commit d6694100 authored by Alexis Reigel's avatar Alexis Reigel

dry up: extract method

parent 9b836b83
module Ci module Ci
class UpdateBuildQueueService class UpdateBuildQueueService
def execute(build) def execute(build)
build.project.runners.each do |runner| tick_for(build, build.project.runners)
if runner.can_pick?(build)
runner.tick_runner_queue
end
end
if build.project.group_runners_enabled? if build.project.group_runners_enabled?
Ci::Runner.belonging_to_group(build.project_id).each do |runner| tick_for(build, Ci::Runner.belonging_to_group(build.project_id))
if runner.can_pick?(build)
runner.tick_runner_queue
end
end
end end
if build.project.shared_runners_enabled? if build.project.shared_runners_enabled?
Ci::Runner.shared.each do |runner| tick_for(build, Ci::Runner.shared)
if runner.can_pick?(build) end
runner.tick_runner_queue end
end
end private
def tick_for(build, runners)
runners.each do |runner|
runner.tick_runner_queue if runner.can_pick?(build)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment