Commit d9d8a737 authored by Adam Hegyi's avatar Adam Hegyi

Cache any_project_with_shared_runners_enabled?

This change caches the any_project_with_shared_runners_enabled? method.
parent 5f965193
---
name: cache_shared_runners_enabled
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68002
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/338267
milestone: '14.2'
type: development
group: group::optimize
default_enabled: false
......@@ -256,8 +256,14 @@ module EE
end
def any_project_with_shared_runners_enabled?
if ::Feature.enabled?(:cache_shared_runners_enabled, self, default_enabled: :yaml)
Rails.cache.fetch([self, :has_project_with_shared_runners_enabled], expires_in: 5.minutes) do
all_projects.with_shared_runners.any?
end
else
all_projects.with_shared_runners.any?
end
end
# These helper methods are required to not break the Namespace API.
def memoized_plans=(plans)
......
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