Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-12-19 11:34:34 +0300
committerMark Chao <mchao@gitlab.com>2019-01-08 10:19:45 +0300
commit3ab5af14a2e2ea9668b611f7b4bcf56b9f722161 (patch)
tree5b9cec865827f679042d39fac718beaf85367e14 /lib
parent1d2ef4c6557846eb531f4d0e80cf43dea99b037b (diff)
Check if specific type of background migration are done
Useful for checking progress.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/background_migration.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/gitlab/background_migration.rb b/lib/gitlab/background_migration.rb
index d72befce571..6cf40e2d4ca 100644
--- a/lib/gitlab/background_migration.rb
+++ b/lib/gitlab/background_migration.rb
@@ -51,6 +51,19 @@ module Gitlab
migration_class_for(class_name).new.perform(*arguments)
end
+ def self.exists?(migration_class)
+ enqueued = Sidekiq::Queue.new(self.queue)
+ scheduled = Sidekiq::ScheduledSet.new
+
+ [enqueued, scheduled].each do |queue|
+ queue.each do |job|
+ return true if job.queue == self.queue && job.args.first == migration_class
+ end
+ end
+
+ false
+ end
+
def self.migration_class_for(class_name)
const_get(class_name)
end