diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-04-03 14:15:12 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-04-03 14:15:12 +0000 |
commit | ff3703f5e6e386d28790c3b395341bcf15b04c13 (patch) | |
tree | 8d8c29179ac25b472d751e237b6bb86ba05b67cc /app | |
parent | dcbd090cba92872e55528ecf7f7adffd3ffe70f7 (diff) | |
parent | 6a2d022d1d578f8957736de2fb895069c24c072b (diff) | |
download | gitlab-ce-ff3703f5e6e386d28790c3b395341bcf15b04c13.tar.gz |
Merge branch 'sh-fix-destroy-user-race' into 'master'
Fix race condition where a namespace would be deleted before a project was deleted
Closes #30334 and #30306
See merge request !10389
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/registrations_controller.rb | 4 | ||||
-rw-r--r-- | app/services/users/destroy_service.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index a49a1f50a81..8109427a45f 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -25,12 +25,12 @@ class RegistrationsController < Devise::RegistrationsController end def destroy - Users::DestroyService.new(current_user).execute(current_user) + DeleteUserWorker.perform_async(current_user.id, current_user.id) respond_to do |format| format.html do session.try(:destroy) - redirect_to new_user_session_path, notice: "Account successfully removed." + redirect_to new_user_session_path, notice: "Account scheduled for removal." end end end diff --git a/app/services/users/destroy_service.rb b/app/services/users/destroy_service.rb index 833da5bc5d1..a3b32a71a64 100644 --- a/app/services/users/destroy_service.rb +++ b/app/services/users/destroy_service.rb @@ -20,10 +20,10 @@ module Users Groups::DestroyService.new(group, current_user).execute end - user.personal_projects.each do |project| + user.personal_projects.with_deleted.each do |project| # Skip repository removal because we remove directory with namespace # that contain all this repositories - ::Projects::DestroyService.new(project, current_user, skip_repo: true).async_execute + ::Projects::DestroyService.new(project, current_user, skip_repo: true).execute end move_issues_to_ghost_user(user) |