summaryrefslogtreecommitdiff
path: root/lib/gitlab/hashed_storage/migrator.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/hashed_storage/migrator.rb')
-rw-r--r--lib/gitlab/hashed_storage/migrator.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/gitlab/hashed_storage/migrator.rb b/lib/gitlab/hashed_storage/migrator.rb
index 7046b4e2a43..f5368d41629 100644
--- a/lib/gitlab/hashed_storage/migrator.rb
+++ b/lib/gitlab/hashed_storage/migrator.rb
@@ -81,8 +81,26 @@ module Gitlab
Rails.logger.error("#{err.message} rolling-back storage of #{project.full_path} (ID=#{project.id}), trace - #{err.backtrace}")
end
+ # Returns whether we have any pending storage migration
+ #
+ def migration_pending?
+ any_non_empty_queue?(::HashedStorage::MigratorWorker, ::HashedStorage::ProjectMigrateWorker)
+ end
+
+ # Returns whether we have any pending storage rollback
+ #
+ def rollback_pending?
+ any_non_empty_queue?(::HashedStorage::RollbackerWorker, ::HashedStorage::ProjectRollbackWorker)
+ end
+
private
+ def any_non_empty_queue?(*workers)
+ workers.any? do |worker|
+ worker.jobs.any?
+ end
+ end
+
# rubocop: disable CodeReuse/ActiveRecord
def build_relation(start, finish)
relation = Project