diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 03:09:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-25 03:09:12 +0300 |
commit | 0b881f91159cc97ccb7328a2e52977a60ea83fbe (patch) | |
tree | d6b683cb935112aee47121f46e3c5dc84de24f2c /db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb | |
parent | 7671216b60e2796a050358ff808b4a0c2de3d22f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb')
-rw-r--r-- | db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb b/db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb new file mode 100644 index 00000000000..13b041d8f95 --- /dev/null +++ b/db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class DropActivatePrometheusServicesBackgroundJobs < ActiveRecord::Migration[6.0] + DOWNTIME = false + DROPPED_JOB_CLASS = 'ActivatePrometheusServicesForSharedClusterApplications'.freeze + QUEUE = 'background_migration'.freeze + + def up + sidekiq_queues.each do |queue| + 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 + + def down + # no-op + end + + def sidekiq_queues + [Sidekiq::ScheduledSet.new, Sidekiq::RetrySet.new, Sidekiq::Queue.new(QUEUE)] + end +end |