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
9c66889c
Commit
9c66889c
authored
Nov 16, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo - Fix disk_path when replaying repository deleted events
parent
b562f53a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
13 deletions
+12
-13
app/services/geo/repository_destroy_service.rb
app/services/geo/repository_destroy_service.rb
+5
-5
app/workers/geo_repository_destroy_worker.rb
app/workers/geo_repository_destroy_worker.rb
+2
-2
lib/gitlab/geo/log_cursor/daemon.rb
lib/gitlab/geo/log_cursor/daemon.rb
+3
-3
spec/lib/gitlab/geo/log_cursor/daemon_spec.rb
spec/lib/gitlab/geo/log_cursor/daemon_spec.rb
+2
-3
No files found.
app/services/geo/repository_destroy_service.rb
View file @
9c66889c
module
Geo
class
RepositoryDestroyService
attr_reader
:id
,
:name
,
:
full
_path
,
:storage_name
attr_reader
:id
,
:name
,
:
disk
_path
,
:storage_name
def
initialize
(
id
,
name
,
full
_path
,
storage_name
)
def
initialize
(
id
,
name
,
disk
_path
,
storage_name
)
@id
=
id
@name
=
name
@
full_path
=
full
_path
@
disk_path
=
disk
_path
@storage_name
=
storage_name
end
def
async_execute
GeoRepositoryDestroyWorker
.
perform_async
(
id
,
name
,
full
_path
,
storage_name
)
GeoRepositoryDestroyWorker
.
perform_async
(
id
,
name
,
disk
_path
,
storage_name
)
end
def
execute
...
...
@@ -24,7 +24,7 @@ module Geo
# rebuilding only what our service class requires
::
Geo
::
DeletedProject
.
new
(
id:
id
,
name:
name
,
full_path:
full
_path
,
full_path:
disk
_path
,
repository_storage:
storage_name
)
end
end
...
...
app/workers/geo_repository_destroy_worker.rb
View file @
9c66889c
...
...
@@ -3,7 +3,7 @@ class GeoRepositoryDestroyWorker
include
GeoQueue
include
Gitlab
::
ShellAdapter
def
perform
(
id
,
name
,
full
_path
,
storage_name
)
Geo
::
RepositoryDestroyService
.
new
(
id
,
name
,
full
_path
,
storage_name
).
execute
def
perform
(
id
,
name
,
disk
_path
,
storage_name
)
Geo
::
RepositoryDestroyService
.
new
(
id
,
name
,
disk
_path
,
storage_name
).
execute
end
end
lib/gitlab/geo/log_cursor/daemon.rb
View file @
9c66889c
...
...
@@ -122,17 +122,17 @@ module Gitlab
def
handle_repository_deleted
(
event_log
)
event
=
event_log
.
repository_deleted_event
disk_path
=
File
.
join
(
event
.
repository_storage_path
,
event
.
deleted_path
)
job_id
=
::
Geo
::
RepositoryDestroyService
.
new
(
event
.
project_id
,
event
.
deleted_project_name
,
disk
_path
,
event
.
repository_storage_name
)
.
new
(
event
.
project_id
,
event
.
deleted_project_name
,
event
.
deleted
_path
,
event
.
repository_storage_name
)
.
async_execute
logger
.
event_info
(
event_log
.
created_at
,
message:
'Deleted project'
,
project_id:
event
.
project_id
,
disk_path:
disk_path
,
repository_storage_name:
event
.
repository_storage_name
,
disk_path:
event
.
deleted_path
,
job_id:
job_id
)
# No need to create a project entry if it doesn't exist
...
...
spec/lib/gitlab/geo/log_cursor/daemon_spec.rb
View file @
9c66889c
...
...
@@ -150,11 +150,10 @@ describe Gitlab::Geo::LogCursor::Daemon, :postgresql, :clean_gitlab_redis_shared
it
'schedules a GeoRepositoryDestroyWorker'
do
project_id
=
repository_deleted_event
.
project_id
project_name
=
repository_deleted_event
.
deleted_project_name
full_path
=
File
.
join
(
repository_deleted_event
.
repository_storage_path
,
repository_deleted_event
.
deleted_path
)
project_path
=
repository_deleted_event
.
deleted_path
expect
(
::
GeoRepositoryDestroyWorker
).
to
receive
(
:perform_async
)
.
with
(
project_id
,
project_name
,
full
_path
,
project
.
repository_storage
)
.
with
(
project_id
,
project_name
,
project
_path
,
project
.
repository_storage
)
daemon
.
run_once!
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