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
b5137acd
Commit
b5137acd
authored
Jun 22, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a probe to find the current repository_storage
parent
9edf96c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
app/workers/geo_repository_destroy_worker.rb
app/workers/geo_repository_destroy_worker.rb
+21
-1
No files found.
app/workers/geo_repository_destroy_worker.rb
View file @
b5137acd
...
@@ -3,10 +3,30 @@ class GeoRepositoryDestroyWorker
...
@@ -3,10 +3,30 @@ class GeoRepositoryDestroyWorker
include
GeoQueue
include
GeoQueue
def
perform
(
id
,
name
,
path_with_namespace
)
def
perform
(
id
,
name
,
path_with_namespace
)
repository_storage
=
probe_repository_storage
(
path_with_namespace
)
# We don't have access to the original model anymore, so we are
# We don't have access to the original model anymore, so we are
# rebuilding only what our service class requires
# rebuilding only what our service class requires
project
=
::
Geo
::
DeletedProject
.
new
(
id:
id
,
name:
name
,
path_with_namespace:
path_with_namespace
)
project
=
::
Geo
::
DeletedProject
.
new
(
id:
id
,
name:
name
,
path_with_namespace:
path_with_namespace
,
repository_storage:
repository_storage
)
::
Projects
::
DestroyService
.
new
(
project
,
nil
).
geo_replicate
::
Projects
::
DestroyService
.
new
(
project
,
nil
).
geo_replicate
end
end
private
# Detect in which repository_storage the project repository is stored.
#
# As we don't have access to `repository_storage` from the data in the Hook notification
# we need to probe on all existing ones.
#
# if we don't find it means it has already been deleted and we just return
def
probe_repository_storage
(
path_with_namespace
)
gitlab_shell
=
Gitlab
::
Shell
.
new
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
repository_storage
,
rs_data
|
return
repository_storage
if
gitlab_shell
.
exists?
(
rs_data
[
'path'
],
path_with_namespace
+
'.git'
)
end
nil
end
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