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
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20200116051619_drop_background_migration_jobs.rb')
-rw-r--r--db/migrate/20200116051619_drop_background_migration_jobs.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20200116051619_drop_background_migration_jobs.rb b/db/migrate/20200116051619_drop_background_migration_jobs.rb
new file mode 100644
index 00000000000..f492ec0af9d
--- /dev/null
+++ b/db/migrate/20200116051619_drop_background_migration_jobs.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class DropBackgroundMigrationJobs < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ DROPPED_JOB_CLASS = 'ActivatePrometheusServicesForSharedClusterApplications'
+ QUEUE = 'background_migration'
+
+ def up
+ Sidekiq::Queue.new(QUEUE).each do |job|
+ klass, project_id, *should_be_empty = job.args
+ next unless klass == DROPPED_JOB_CLASS && project_id.is_a?(Integer) && should_be_empty.empty?
+
+ job.delete
+ end
+ end
+end