Commit 54640315 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add build stuck badge performance experiment

This commit adds a new feature flag that will be used to run an
experiment that will allow us to evaluate possible database peformance
improvement related to not running an expensive SQL query for every
runner in a project.
parent 43e0d5ee
......@@ -723,7 +723,13 @@ module Ci
end
def any_runners_online?
project.any_runners? { |runner| runner.active? && runner.online? && runner.can_pick?(self) }
project.any_runners? do |runner|
if Feature.enabled?(:ci_build_stuck_badge_performance_experiment, project, type: :development, default_enabled: false)
runner.active? && runner.online?
else
runner.active? && runner.online? && runner.can_pick?(self)
end
end
end
def stuck?
......
---
title: Add build stuck badge performance experiment
merge_request: 50521
author:
type: performance
---
name: ci_build_stuck_badge_performance_experiment
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50521
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/295490
milestone: '13.7'
type: development
group: group::continuous integration
default_enabled: false
......@@ -580,9 +580,27 @@ RSpec.describe Ci::Build do
is_expected.to be_falsey
end
it 'that cannot handle build' do
expect_any_instance_of(Ci::Runner).to receive(:can_pick?).and_return(false)
is_expected.to be_falsey
context 'when runners are on-line but none can pick a build' do
before do
allow_any_instance_of(Ci::Runner)
.to receive(:can_pick?).and_return(false)
end
context 'when a performance experiement feature flag is enabled' do
before do
stub_feature_flags(ci_build_stuck_badge_performance_experiment: true)
end
it { is_expected.to be_truthy }
end
context 'when a performance experiment is not running' do
before do
stub_feature_flags(ci_build_stuck_badge_performance_experiment: false)
end
it { is_expected.to be_falsey }
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