diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /app/services/protected_branches | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'app/services/protected_branches')
-rw-r--r-- | app/services/protected_branches/cache_service.rb | 6 | ||||
-rw-r--r-- | app/services/protected_branches/destroy_service.rb | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/app/services/protected_branches/cache_service.rb b/app/services/protected_branches/cache_service.rb index af8c9ce74bb..4a9fc335421 100644 --- a/app/services/protected_branches/cache_service.rb +++ b/app/services/protected_branches/cache_service.rb @@ -81,7 +81,11 @@ module ProtectedBranches end def metrics - @metrics ||= Gitlab::Cache::Metrics.new( + @metrics ||= Gitlab::Cache::Metrics.new(cache_metadata) + end + + def cache_metadata + Gitlab::Cache::Metadata.new( caller_id: Gitlab::ApplicationContext.current_context_attribute(:caller_id), cache_identifier: "#{self.class}#fetch", feature_category: :source_code_management, diff --git a/app/services/protected_branches/destroy_service.rb b/app/services/protected_branches/destroy_service.rb index a32a867491e..011dbf3515d 100644 --- a/app/services/protected_branches/destroy_service.rb +++ b/app/services/protected_branches/destroy_service.rb @@ -5,7 +5,10 @@ module ProtectedBranches def execute(protected_branch) raise Gitlab::Access::AccessDeniedError unless can?(current_user, :destroy_protected_branch, protected_branch) - protected_branch.destroy.tap { refresh_cache } + protected_branch.destroy.tap do + refresh_cache + after_execute + end end end end |