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
Kazuhiko Shiozaki
gitlab-ce
Commits
e1fff018
Commit
e1fff018
authored
Oct 16, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear archive cache asynchronously
parent
dad30ec0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
10 deletions
+20
-10
CHANGELOG
CHANGELOG
+1
-0
app/models/repository.rb
app/models/repository.rb
+8
-8
app/services/archive_repository_service.rb
app/services/archive_repository_service.rb
+1
-1
app/workers/repository_archive_cache_worker.rb
app/workers/repository_archive_cache_worker.rb
+9
-0
spec/services/archive_repository_service_spec.rb
spec/services/archive_repository_service_spec.rb
+1
-1
No files found.
CHANGELOG
View file @
e1fff018
...
...
@@ -67,6 +67,7 @@ v 8.1.0 (unreleased)
- Only render 404 page from /public
- Hide passwords from services API (Alex Lossent)
- Fix: Images cannot show when projects' path was changed
- Let gitlab-git-http-server generate and serve 'git archive' downloads
v 8.0.4
- Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)
...
...
app/models/repository.rb
View file @
e1fff018
...
...
@@ -8,6 +8,14 @@ class Repository
attr_accessor
:raw_repository
,
:path_with_namespace
,
:project
def
self
.
clean_old_archives
repository_downloads_path
=
Gitlab
.
config
.
gitlab
.
repository_downloads_path
return
unless
File
.
directory?
(
repository_downloads_path
)
Gitlab
::
Popen
.
popen
(
%W(find
#{
repository_downloads_path
}
-not -path
#{
repository_downloads_path
}
-mmin +120 -delete)
)
end
def
initialize
(
path_with_namespace
,
default_branch
=
nil
,
project
=
nil
)
@path_with_namespace
=
path_with_namespace
@project
=
project
...
...
@@ -269,14 +277,6 @@ class Repository
end
# Remove archives older than 2 hours
def
clean_old_archives
repository_downloads_path
=
Gitlab
.
config
.
gitlab
.
repository_downloads_path
return
unless
File
.
directory?
(
repository_downloads_path
)
Gitlab
::
Popen
.
popen
(
%W(find
#{
repository_downloads_path
}
-not -path
#{
repository_downloads_path
}
-mmin +120 -delete)
)
end
def
branches_sorted_by
(
value
)
case
value
when
'recently_updated'
...
...
app/services/archive_repository_service.rb
View file @
e1fff018
...
...
@@ -7,7 +7,7 @@ class ArchiveRepositoryService
end
def
execute
(
options
=
{})
project
.
repository
.
clean_old_archives
RepositoryArchiveCacheWorker
.
perform_async
metadata
=
project
.
repository
.
archive_metadata
(
ref
,
storage_path
,
format
)
raise
"Repository or ref not found"
if
metadata
.
empty?
...
...
app/workers/repository_archive_cache_worker.rb
0 → 100644
View file @
e1fff018
class
RepositoryArchiveCacheWorker
include
Sidekiq
::
Worker
sidekiq_options
queue: :default
def
perform
Repository
.
clean_old_archives
end
end
spec/services/archive_repository_service_spec.rb
View file @
e1fff018
...
...
@@ -6,7 +6,7 @@ describe ArchiveRepositoryService do
describe
"#execute"
do
it
"cleans old archives"
do
expect
(
project
.
repository
).
to
receive
(
:clean_old_archives
)
expect
(
RepositoryArchiveCacheWorker
).
to
receive
(
:perform_async
)
subject
.
execute
(
timeout:
0.0
)
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