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
34aeb3b2
Commit
34aeb3b2
authored
Jul 15, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleans up mirror capacity if project is a scheduled mirror
parent
629a37f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
app/services/ee/projects/destroy_service.rb
app/services/ee/projects/destroy_service.rb
+7
-0
changelogs/unreleased-ee/mirror-cleanup-in-project-destroy-service.yml
...released-ee/mirror-cleanup-in-project-destroy-service.yml
+5
-0
spec/services/ee/projects/destroy_service_spec.rb
spec/services/ee/projects/destroy_service_spec.rb
+13
-0
No files found.
app/services/ee/projects/destroy_service.rb
View file @
34aeb3b2
...
...
@@ -6,9 +6,16 @@ module EE
super
mirror_cleanup
(
project
)
log_geo_event
(
project
)
end
def
mirror_cleanup
(
project
)
return
unless
project
.
mirror?
::
Gitlab
::
Mirror
.
decrement_capacity
(
project
.
id
)
end
def
log_geo_event
(
project
)
::
Geo
::
RepositoryDeletedEventStore
.
new
(
project
,
repo_path:
repo_path
,
...
...
changelogs/unreleased-ee/mirror-cleanup-in-project-destroy-service.yml
0 → 100644
View file @
34aeb3b2
---
title
:
Cleans up mirror capacity in project destroy service if project is a scheduled
mirror
merge_request
:
2445
author
:
spec/services/ee/projects/destroy_service_spec.rb
View file @
34aeb3b2
...
...
@@ -18,6 +18,19 @@ describe Projects::DestroyService, services: true do
stub_container_registry_tags
(
repository: :any
,
tags:
[])
end
context
'when project is a mirror'
do
it
'decrements capacity if mirror was scheduled'
do
max_capacity
=
current_application_settings
.
mirror_max_capacity
project_mirror
=
create
(
:project
,
:mirror
,
:repository
,
:import_scheduled
)
Gitlab
::
Mirror
.
increment_capacity
(
project_mirror
.
id
)
expect
do
Projects
::
DestroyService
.
new
(
project_mirror
,
project_mirror
.
owner
,
{}).
execute
end
.
to
change
{
Gitlab
::
Mirror
.
available_capacity
}.
from
(
max_capacity
-
1
).
to
(
max_capacity
)
end
end
context
'when running on a primary node'
do
let!
(
:geo_node
)
{
create
(
:geo_node
,
:primary
,
:current
)
}
...
...
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