diff options
author | Mark Chao <mchao@gitlab.com> | 2018-12-19 11:34:34 +0300 |
---|---|---|
committer | Mark Chao <mchao@gitlab.com> | 2019-01-08 10:19:45 +0300 |
commit | 3ab5af14a2e2ea9668b611f7b4bcf56b9f722161 (patch) | |
tree | 5b9cec865827f679042d39fac718beaf85367e14 /lib | |
parent | 1d2ef4c6557846eb531f4d0e80cf43dea99b037b (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.rb | 13 |
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 |