2018-07-16 12:31:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-15 16:37:52 -05:00
|
|
|
module Ci
|
2016-12-20 22:27:03 -05:00
|
|
|
class UpdateBuildQueueService
|
2016-12-15 16:37:52 -05:00
|
|
|
def execute(build)
|
2018-04-30 09:25:49 -04:00
|
|
|
tick_for(build, build.project.all_runners)
|
2017-10-30 11:17:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def tick_for(build, runners)
|
2019-08-22 07:08:46 -04:00
|
|
|
if Feature.enabled?(:ci_update_queues_for_online_runners, build.project, default_enabled: true)
|
|
|
|
runners = runners.with_recent_runner_queue
|
|
|
|
end
|
|
|
|
|
2017-10-30 11:17:17 -04:00
|
|
|
runners.each do |runner|
|
2018-05-02 10:42:12 -04:00
|
|
|
runner.pick_build!(build)
|
2017-01-20 08:32:32 -05:00
|
|
|
end
|
2016-12-15 16:37:52 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|