diff options
author | Toon Claes <toon@gitlab.com> | 2017-05-09 23:16:52 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-05-10 16:01:27 +0300 |
commit | 37a79409d446955eeb443ea5397d5bf263601a2d (patch) | |
tree | c3e9ada5f5f50e11a48feb4e5edf2837963eafc3 /db/post_migrate | |
parent | 0ad80cab40097658b1eec5b87d440cfcd60d2755 (diff) |
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/post_migrate')
-rw-r--r-- | db/post_migrate/20170502101023_cleanup_namespaceless_pending_delete_projects.rb | 9 |
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 |