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
a2c5925e
Commit
a2c5925e
authored
Jul 30, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
4512656d
14e7cbe5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
app/services/projects/destroy_service.rb
app/services/projects/destroy_service.rb
+11
-2
changelogs/unreleased/sh-ignore-git-errors-delete-project.yml
...gelogs/unreleased/sh-ignore-git-errors-delete-project.yml
+5
-0
spec/services/projects/destroy_service_spec.rb
spec/services/projects/destroy_service_spec.rb
+16
-1
No files found.
app/services/projects/destroy_service.rb
View file @
a2c5925e
...
...
@@ -210,12 +210,21 @@ module Projects
end
def
flush_caches
(
project
)
project
.
repository
.
before_delete
ignore_git_errors
(
repo_path
)
{
project
.
repository
.
before_delete
}
Repository
.
new
(
wiki_path
,
project
,
disk_path:
repo_path
).
before_delete
ignore_git_errors
(
wiki_path
)
{
Repository
.
new
(
wiki_path
,
project
,
disk_path:
repo_path
).
before_delete
}
Projects
::
ForksCountService
.
new
(
project
).
delete_cache
end
# If we get a Gitaly error, the repository may be corrupted. We can
# ignore these errors since we're going to trash the repositories
# anyway.
def
ignore_git_errors
(
disk_path
,
&
block
)
yield
rescue
Gitlab
::
Git
::
CommandError
=>
e
Gitlab
::
GitLogger
.
warn
(
class:
self
.
class
.
name
,
project_id:
project
.
id
,
disk_path:
disk_path
,
message:
e
.
to_s
)
end
end
end
...
...
changelogs/unreleased/sh-ignore-git-errors-delete-project.yml
0 → 100644
View file @
a2c5925e
---
title
:
Ignore Gitaly errors if cache flushing fails on project destruction
merge_request
:
31164
author
:
type
:
fixed
spec/services/projects/destroy_service_spec.rb
View file @
a2c5925e
...
...
@@ -121,7 +121,22 @@ describe Projects::DestroyService do
it
{
expect
(
Dir
.
exist?
(
remove_path
)).
to
be_truthy
}
end
context
'when flushing caches fail'
do
context
'when flushing caches fail due to Git errors'
do
before
do
allow
(
project
.
repository
).
to
receive
(
:before_delete
).
and_raise
(
::
Gitlab
::
Git
::
CommandError
)
allow
(
Gitlab
::
GitLogger
).
to
receive
(
:warn
).
with
(
class:
described_class
.
name
,
project_id:
project
.
id
,
disk_path:
project
.
disk_path
,
message:
'Gitlab::Git::CommandError'
).
and_call_original
perform_enqueued_jobs
{
destroy_project
(
project
,
user
,
{})
}
end
it_behaves_like
'deleting the project'
end
context
'when flushing caches fail due to Redis'
do
before
do
new_user
=
create
(
:user
)
project
.
team
.
add_user
(
new_user
,
Gitlab
::
Access
::
DEVELOPER
)
...
...
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