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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
285d5d52
Commit
285d5d52
authored
Feb 05, 2018
by
Bastian Blank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close low level rugged repository in project cache worker
Signed-off-by:
Bastian Blank
<
waldi@debian.org
>
parent
1214d8de
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
1 deletion
+19
-1
app/models/project.rb
app/models/project.rb
+4
-1
app/models/repository.rb
app/models/repository.rb
+4
-0
app/workers/project_cache_worker.rb
app/workers/project_cache_worker.rb
+2
-0
changelogs/unreleased/42730-close-rugged-repository.yml
changelogs/unreleased/42730-close-rugged-repository.yml
+5
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+4
-0
No files found.
app/models/project.rb
View file @
285d5d52
...
@@ -511,10 +511,13 @@ class Project < ActiveRecord::Base
...
@@ -511,10 +511,13 @@ class Project < ActiveRecord::Base
@repository
||=
Repository
.
new
(
full_path
,
self
,
disk_path:
disk_path
)
@repository
||=
Repository
.
new
(
full_path
,
self
,
disk_path:
disk_path
)
end
end
def
reload_repository!
def
cleanup
@repository
&
.
cleanup
@repository
=
nil
@repository
=
nil
end
end
alias_method
:reload_repository!
,
:cleanup
def
container_registry_url
def
container_registry_url
if
Gitlab
.
config
.
registry
.
enabled
if
Gitlab
.
config
.
registry
.
enabled
"
#{
Gitlab
.
config
.
registry
.
host_port
}
/
#{
full_path
.
downcase
}
"
"
#{
Gitlab
.
config
.
registry
.
host_port
}
/
#{
full_path
.
downcase
}
"
...
...
app/models/repository.rb
View file @
285d5d52
...
@@ -93,6 +93,10 @@ class Repository
...
@@ -93,6 +93,10 @@ class Repository
alias_method
:raw
,
:raw_repository
alias_method
:raw
,
:raw_repository
def
cleanup
@raw_repository
&
.
cleanup
end
# Return absolute path to repository
# Return absolute path to repository
def
path_to_repo
def
path_to_repo
@path_to_repo
||=
File
.
expand_path
(
@path_to_repo
||=
File
.
expand_path
(
...
...
app/workers/project_cache_worker.rb
View file @
285d5d52
...
@@ -18,6 +18,8 @@ class ProjectCacheWorker
...
@@ -18,6 +18,8 @@ class ProjectCacheWorker
update_statistics
(
project
,
statistics
.
map
(
&
:to_sym
))
update_statistics
(
project
,
statistics
.
map
(
&
:to_sym
))
project
.
repository
.
refresh_method_caches
(
files
.
map
(
&
:to_sym
))
project
.
repository
.
refresh_method_caches
(
files
.
map
(
&
:to_sym
))
project
.
cleanup
end
end
def
update_statistics
(
project
,
statistics
=
[])
def
update_statistics
(
project
,
statistics
=
[])
...
...
changelogs/unreleased/42730-close-rugged-repository.yml
0 → 100644
View file @
285d5d52
---
title
:
Close low level rugged repository in project cache worker
merge_request
:
16930
author
:
Bastian Blank
type
:
fixed
lib/gitlab/git/repository.rb
View file @
285d5d52
...
@@ -128,6 +128,10 @@ module Gitlab
...
@@ -128,6 +128,10 @@ module Gitlab
raise
NoRepository
.
new
(
'no repository for such path'
)
raise
NoRepository
.
new
(
'no repository for such path'
)
end
end
def
cleanup
@rugged
&
.
close
end
def
circuit_breaker
def
circuit_breaker
@circuit_breaker
||=
Gitlab
::
Git
::
Storage
::
CircuitBreaker
.
for_storage
(
storage
)
@circuit_breaker
||=
Gitlab
::
Git
::
Storage
::
CircuitBreaker
.
for_storage
(
storage
)
end
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