summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-05-09 22:16:52 +0200
committerToon Claes <toon@gitlab.com>2017-05-10 15:01:27 +0200
commit37a79409d446955eeb443ea5397d5bf263601a2d (patch)
treec3e9ada5f5f50e11a48feb4e5edf2837963eafc3 /db
parent0ad80cab40097658b1eec5b87d440cfcd60d2755 (diff)
downloadgitlab-ce-37a79409d446955eeb443ea5397d5bf263601a2d.tar.gz
No user needed to cleanup namespaceless pending delete projects
Since this is a cleanup, ran by a post-deploy, there is no need to lookup the admin to run the cleanup.
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20170502101023_cleanup_namespaceless_pending_delete_projects.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/db/post_migrate/20170502101023_cleanup_namespaceless_pending_delete_projects.rb b/db/post_migrate/20170502101023_cleanup_namespaceless_pending_delete_projects.rb
index 76ed109898b..2d242da9ef8 100644
--- a/db/post_migrate/20170502101023_cleanup_namespaceless_pending_delete_projects.rb
+++ b/db/post_migrate/20170502101023_cleanup_namespaceless_pending_delete_projects.rb
@@ -8,17 +8,14 @@ class CleanupNamespacelessPendingDeleteProjects < ActiveRecord::Migration
disable_ddl_transaction!
def up
- admin = User.find_by(admin: true)
- return unless admin
-
@offset = 0
loop do
ids = pending_delete_batch
- break if ids.rows.count.zero?
+ break if ids.empty?
- args = ids.map { |id| [id['id'], admin.id, {}] }
+ args = ids.map { |id| Array(id) }
NamespacelessProjectDestroyWorker.bulk_perform_async(args)
@@ -33,7 +30,7 @@ class CleanupNamespacelessPendingDeleteProjects < ActiveRecord::Migration
private
def pending_delete_batch
- connection.exec_query(find_batch)
+ connection.exec_query(find_batch).map{ |row| row['id'] }
end
BATCH_SIZE = 5000