Welcome to mirror list, hosted at ThFree Co, Russian Federation.

update_build_queue_service.rb « ci « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cf629b879b3a53f66f7e9306f9787b0b18abebff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module Ci
  class UpdateBuildQueueService
    def execute(build, metrics = ::Gitlab::Ci::Queue::Metrics)
      tick_for(build, build.project.all_runners, metrics)
    end

    private

    def tick_for(build, runners, metrics)
      runners = runners.with_recent_runner_queue
      runners = runners.with_tags if Feature.enabled?(:ci_preload_runner_tags, default_enabled: :yaml)

      metrics.observe_active_runners(-> { runners.to_a.size })

      runners.each do |runner|
        metrics.increment_runner_tick(runner)

        runner.pick_build!(build)
      end
    end
  end
end