diff options
author | Stan Hu <stanhu@gmail.com> | 2017-03-25 01:02:23 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-03-25 01:02:23 +0300 |
commit | e1bb8c99cf7840c8b5d981111857b7d16b9cc1bd (patch) | |
tree | 9737570f75dbb84a325537cd1863301e42234fee /db/post_migrate/20170313133418_rename_more_reserved_project_names.rb | |
parent | f6ededfa07a2fe9f3dd1c4d7e247b0f784f8181a (diff) | |
parent | f1e1e51311b6f50c98b3e1476942107269c28a97 (diff) |
Merge branch 'master' into sh-bring-back-option-to-be-notified-of-own-activity
Diffstat (limited to 'db/post_migrate/20170313133418_rename_more_reserved_project_names.rb')
-rw-r--r-- | db/post_migrate/20170313133418_rename_more_reserved_project_names.rb | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb b/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb index 9dfe77bedb7..44c688fa134 100644 --- a/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb +++ b/db/post_migrate/20170313133418_rename_more_reserved_project_names.rb @@ -6,41 +6,12 @@ class RenameMoreReservedProjectNames < ActiveRecord::Migration DOWNTIME = false - THREAD_COUNT = 8 - KNOWN_PATHS = %w(artifacts graphs refs badges).freeze def up - queues = Array.new(THREAD_COUNT) { Queue.new } - start = false - - threads = Array.new(THREAD_COUNT) do |index| - Thread.new do - queue = queues[index] - - # Wait until we have input to process. - until start; end - - rename_projects(queue.pop) until queue.empty? - end - end - - enum = queues.each - reserved_projects.each_slice(100) do |slice| - begin - queue = enum.next - rescue StopIteration - enum.rewind - retry - end - - queue << slice + rename_projects(slice) end - - start = true - - threads.each(&:join) end def down |