Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
59e73d35
Commit
59e73d35
authored
May 05, 2021
by
Marc Shaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Memoize the code owners file after loading
MR: gitlab.com/gitlab-org/gitlab/-/merge_requests/60980
parent
4b53a281
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
ee/lib/gitlab/code_owners/loader.rb
ee/lib/gitlab/code_owners/loader.rb
+1
-5
ee/spec/lib/gitlab/code_owners/loader_spec.rb
ee/spec/lib/gitlab/code_owners/loader_spec.rb
+6
-0
No files found.
ee/lib/gitlab/code_owners/loader.rb
View file @
59e73d35
...
...
@@ -62,11 +62,7 @@ module Gitlab
end
def
code_owners_file
if
RequestStore
.
active?
RequestStore
.
fetch
(
"project-
#{
@project
.
id
}
:code-owners:
#{
@ref
}
"
)
do
load_code_owners_file
end
else
@code_owners_file
||=
Gitlab
::
SafeRequestStore
.
fetch
(
"project-
#{
@project
.
id
}
:code-owners:
#{
@ref
}
"
)
do
load_code_owners_file
end
end
...
...
ee/spec/lib/gitlab/code_owners/loader_spec.rb
View file @
59e73d35
...
...
@@ -43,6 +43,12 @@ RSpec.describe Gitlab::CodeOwners::Loader do
expect
(
loader
.
entries
).
to
contain_exactly
(
expected_entry
)
end
it
'only calls out to the repository once'
do
expect
(
project
.
repository
).
to
receive
(
:code_owners_blob
).
once
2
.
times
{
loader
.
entries
}
end
it
'loads all users that are members of the project into the entry'
do
expect
(
first_entry
.
users
).
to
contain_exactly
(
owner_1
,
email_owner
,
documentation_owner
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment