BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e4ef2406
Commit
e4ef2406
authored
Sep 14, 2017
by
Kamil Trzciński
Committed by
Jarka Kadlecova
Sep 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'repo-cache-fix' into 'master'
Restore has_visible_content? to improve performance (cache) See merge request gitlab-org/gitlab-ce!14264
parent
e83260bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
repository.rb
app/models/repository.rb
+6
-0
git_garbage_collect_worker_spec.rb
spec/workers/git_garbage_collect_worker_spec.rb
+2
-2
No files found.
app/models/repository.rb
View file @
e4ef2406
...
...
@@ -90,6 +90,12 @@ class Repository
)
end
# we need to have this method here because it is not cached in ::Git and
# the method is called multiple times for every request
def
has_visible_content?
branch_count
>
0
end
def
inspect
"#<
#{
self
.
class
.
name
}
:
#{
@disk_path
}
>"
end
...
...
spec/workers/git_garbage_collect_worker_spec.rb
View file @
e4ef2406
...
...
@@ -31,8 +31,8 @@ describe GitGarbageCollectWorker do
expect_any_instance_of
(
Repository
).
to
receive
(
:after_create_branch
).
and_call_original
expect_any_instance_of
(
Repository
).
to
receive
(
:branch_names
).
and_call_original
expect_any_instance_of
(
Repository
).
to
receive
(
:has_visible_content?
).
and_call_original
expect_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:branch_count
).
and_call_original
expect_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:has_visible_content?
).
and_call_original
subject
.
perform
(
project
.
id
,
:gc
,
lease_key
,
lease_uuid
)
end
...
...
@@ -77,8 +77,8 @@ describe GitGarbageCollectWorker do
expect_any_instance_of
(
Repository
).
to
receive
(
:after_create_branch
).
and_call_original
expect_any_instance_of
(
Repository
).
to
receive
(
:branch_names
).
and_call_original
expect_any_instance_of
(
Repository
).
to
receive
(
:has_visible_content?
).
and_call_original
expect_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:branch_count
).
and_call_original
expect_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:has_visible_content?
).
and_call_original
subject
.
perform
(
project
.
id
)
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