diff options
Diffstat (limited to 'lib/gitlab/database/async_indexes.rb')
-rw-r--r-- | lib/gitlab/database/async_indexes.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/database/async_indexes.rb b/lib/gitlab/database/async_indexes.rb index d89d5238356..6f301a66803 100644 --- a/lib/gitlab/database/async_indexes.rb +++ b/lib/gitlab/database/async_indexes.rb @@ -6,10 +6,16 @@ module Gitlab DEFAULT_INDEXES_PER_INVOCATION = 2 def self.create_pending_indexes!(how_many: DEFAULT_INDEXES_PER_INVOCATION) - PostgresAsyncIndex.order(:id).limit(how_many).each do |async_index| + PostgresAsyncIndex.to_create.order(:id).limit(how_many).each do |async_index| IndexCreator.new(async_index).perform end end + + def self.drop_pending_indexes!(how_many: DEFAULT_INDEXES_PER_INVOCATION) + PostgresAsyncIndex.to_drop.order(:id).limit(how_many).each do |async_index| + IndexDestructor.new(async_index).perform + end + end end end end |