summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-06-23 17:02:33 -0700
committerStan Hu <stanhu@gmail.com>2017-06-29 09:23:31 -0700
commitfa93156528bca4306e040a1b73720b6411942fcf (patch)
tree863375c80f122d59ce57d31eb0f4605d3ea78474 /app/models/namespace.rb
parent5a983ac431affc800d5e9db9e83c14710ec29c36 (diff)
downloadgitlab-ce-fa93156528bca4306e040a1b73720b6411942fcf.tar.gz
Defer project destroys within a namespace in Groups::DestroyService#async_execute
Group#destroy would actually hard-delete all associated projects even though the acts_as_paranoia gem is used, preventing Projects::DestroyService from doing any work. We first noticed this while trying to log all projects deletion to the Geo log.
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 743e0513e02..672eab94c07 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -219,6 +219,12 @@ class Namespace < ActiveRecord::Base
parent.present?
end
+ def soft_delete_without_removing_associations
+ # We can't use paranoia's `#destroy` since this will hard-delete projects.
+ # Project uses `pending_delete` instead of the acts_as_paranoia gem.
+ self.deleted_at = Time.now
+ end
+
private
def repository_storage_paths