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
562fbed3
Commit
562fbed3
authored
Jun 22, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change `path_with_namespace` to `full_path` and other codestyle fixes
parent
3c0a94a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
app/models/geo/deleted_project.rb
app/models/geo/deleted_project.rb
+5
-5
app/workers/geo_repository_destroy_worker.rb
app/workers/geo_repository_destroy_worker.rb
+6
-7
No files found.
app/models/geo/deleted_project.rb
View file @
562fbed3
class
Geo::DeletedProject
<
::
Project
class
Geo::DeletedProject
<
::
Project
after_initialize
:readonly!
after_initialize
:readonly!
attr_reader
:
path_with_namespace
attr_reader
:
full_path
def
initialize
(
id
:,
name
:,
path_with_namespace
:,
repository_storage
:)
def
initialize
(
id
:,
name
:,
full_path
:,
repository_storage
:)
repository_storage
=
current_application_settings
.
pick_repository_storage
unless
repository_storage
repository_storage
||=
current_application_settings
.
pick_
repository_storage
super
(
id:
id
,
name:
name
,
repository_storage:
repository_storage
)
super
(
id:
id
,
name:
name
,
repository_storage:
repository_storage
)
@
path_with_namespace
=
path_with_namespace
@
full_path
=
full_path
end
end
def
repository
def
repository
@repository
||=
Repository
.
new
(
path_with_namespace
,
self
)
@repository
||=
Repository
.
new
(
full_path
,
self
)
end
end
end
end
app/workers/geo_repository_destroy_worker.rb
View file @
562fbed3
class
GeoRepositoryDestroyWorker
class
GeoRepositoryDestroyWorker
include
Sidekiq
::
Worker
include
Sidekiq
::
Worker
include
GeoQueue
include
GeoQueue
include
Gitlab
::
ShellAdapter
def
perform
(
id
,
name
,
path_with_namespace
)
def
perform
(
id
,
name
,
full_path
)
repository_storage
=
probe_repository_storage
(
path_with_namespace
)
repository_storage
=
probe_repository_storage
(
full_path
)
# 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
,
repository_storage:
repository_storage
)
project
=
::
Geo
::
DeletedProject
.
new
(
id:
id
,
name:
name
,
full_path:
full_path
,
repository_storage:
repository_storage
)
::
Projects
::
DestroyService
.
new
(
project
,
nil
).
geo_replicate
::
Projects
::
DestroyService
.
new
(
project
,
nil
).
geo_replicate
end
end
...
@@ -20,11 +21,9 @@ class GeoRepositoryDestroyWorker
...
@@ -20,11 +21,9 @@ class GeoRepositoryDestroyWorker
# we need to probe on all existing ones.
# we need to probe on all existing ones.
#
#
# if we don't find it means it has already been deleted and we just return
# if we don't find it means it has already been deleted and we just return
def
probe_repository_storage
(
path_with_namespace
)
def
probe_repository_storage
(
full_path
)
gitlab_shell
=
Gitlab
::
Shell
.
new
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
repository_storage
,
rs_data
|
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
repository_storage
,
rs_data
|
return
repository_storage
if
gitlab_shell
.
exists?
(
rs_data
[
'path'
],
path_with_namespace
+
'.git'
)
return
repository_storage
if
gitlab_shell
.
exists?
(
rs_data
[
'path'
],
full_path
+
'.git'
)
end
end
nil
nil
...
...
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