diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-03 14:57:12 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-03 14:57:12 +0200 |
commit | 1edff53444ea493ee010a83220cf13ccb381b411 (patch) | |
tree | 51f2f728dee26bd6107c520bb092ddfac84409d1 /app/models/namespace.rb | |
parent | 61cfd1d2733a717934a723d36f60e7bcd09fad05 (diff) | |
download | gitlab-ce-1edff53444ea493ee010a83220cf13ccb381b411.tar.gz |
Remove projects before group/user. Remove namespace directory asyncfix-group-remove
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r-- | app/models/namespace.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 211dfa76b81..8918e4a682e 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -72,7 +72,7 @@ class Namespace < ActiveRecord::Base path.gsub!(/[^a-zA-Z0-9_\-\.]/, "") # Users with the great usernames of "." or ".." would end up with a blank username. - # Work around that by setting their username to "blank", followed by a counter. + # Work around that by setting their username to "blank", followed by a counter. path = "blank" if path.blank? counter = 0 @@ -99,7 +99,14 @@ class Namespace < ActiveRecord::Base end def rm_dir - gitlab_shell.rm_namespace(path) + # Move namespace directory into trash. + # We will remove it later async + new_path = "#{path}+#{id}+deleted" + gitlab_shell.mv_namespace(path, new_path) + + # Remove namespace directroy async with delay so + # GitLab has time to remove all projects first + GitlabShellWorker.perform_in(5.minutes, :rm_namespace, new_path) end def move_dir |