diff --git a/.rubocop_todo/gitlab/bounded_contexts.yml b/.rubocop_todo/gitlab/bounded_contexts.yml index 84cd894639a22302b938a716a391342bf21cc5e1..1344216ad6b39c46bfaedcb3c446f0ebd1f575f1 100644 --- a/.rubocop_todo/gitlab/bounded_contexts.yml +++ b/.rubocop_todo/gitlab/bounded_contexts.yml @@ -3586,7 +3586,6 @@ Gitlab/BoundedContexts: - 'ee/app/workers/elastic_namespace_rollout_worker.rb' - 'ee/app/workers/elastic_remove_expired_namespace_subscriptions_from_index_cron_worker.rb' - 'ee/app/workers/elastic_wiki_indexer_worker.rb' - - 'ee/app/workers/emails/abandoned_trial_emails_cron_worker.rb' - 'ee/app/workers/epics/new_epic_issue_worker.rb' - 'ee/app/workers/epics/update_cached_metadata_worker.rb' - 'ee/app/workers/epics/update_epics_dates_worker.rb' diff --git a/.rubocop_todo/layout/line_break_after_final_mixin.yml b/.rubocop_todo/layout/line_break_after_final_mixin.yml index 97717e5f21d153a7ea41f4ed2569979bcae883b5..ff487ba596d07d93ee53b25ff6d44297aea11e5e 100644 --- a/.rubocop_todo/layout/line_break_after_final_mixin.yml +++ b/.rubocop_todo/layout/line_break_after_final_mixin.yml @@ -82,7 +82,6 @@ Layout/LineBreakAfterFinalMixin: - 'ee/app/workers/analytics/value_stream_dashboard/count_worker.rb' - 'ee/app/workers/arkose/blocked_users_report_worker.rb' - 'ee/app/workers/elastic_indexing_control_worker.rb' - - 'ee/app/workers/emails/abandoned_trial_emails_cron_worker.rb' - 'ee/app/workers/geo/metrics_update_worker.rb' - 'ee/app/workers/geo/sidekiq_cron_config_worker.rb' - 'ee/app/workers/gitlab_subscriptions/notify_seats_exceeded_batch_worker.rb' diff --git a/.rubocop_todo/sidekiq_load_balancing/worker_data_consistency.yml b/.rubocop_todo/sidekiq_load_balancing/worker_data_consistency.yml index 740e34513e72adb9f15b2d3050a45f9b056a2ecd..9e6e93450439f71c9182b9aca2ecdf6b3d0ac61d 100644 --- a/.rubocop_todo/sidekiq_load_balancing/worker_data_consistency.yml +++ b/.rubocop_todo/sidekiq_load_balancing/worker_data_consistency.yml @@ -319,7 +319,6 @@ SidekiqLoadBalancing/WorkerDataConsistency: - 'ee/app/workers/elastic_indexing_control_worker.rb' - 'ee/app/workers/elastic_namespace_rollout_worker.rb' - 'ee/app/workers/elastic_remove_expired_namespace_subscriptions_from_index_cron_worker.rb' - - 'ee/app/workers/emails/abandoned_trial_emails_cron_worker.rb' - 'ee/app/workers/epics/new_epic_issue_worker.rb' - 'ee/app/workers/epics/update_cached_metadata_worker.rb' - 'ee/app/workers/epics/update_epics_dates_worker.rb' diff --git a/.rubocop_todo/style/inline_disable_annotation.yml b/.rubocop_todo/style/inline_disable_annotation.yml index bda46cbd1146f899e235396de992f374238e958d..b41eb33cc33c4e4aeed6fb7e61abd19abecea641 100644 --- a/.rubocop_todo/style/inline_disable_annotation.yml +++ b/.rubocop_todo/style/inline_disable_annotation.yml @@ -1517,7 +1517,6 @@ Style/InlineDisableAnnotation: - 'ee/app/workers/elastic_index_bulk_cron_worker.rb' - 'ee/app/workers/elastic_index_initial_bulk_cron_worker.rb' - 'ee/app/workers/elastic_namespace_rollout_worker.rb' - - 'ee/app/workers/emails/abandoned_trial_emails_cron_worker.rb' - 'ee/app/workers/epics/new_epic_issue_worker.rb' - 'ee/app/workers/epics/update_epics_dates_worker.rb' - 'ee/app/workers/geo/bulk_mark_pending_batch_worker.rb' diff --git a/db/migrate/20241002181047_remove_abandoned_trial_emails_cron_worker_job_instances.rb b/db/migrate/20241002181047_remove_abandoned_trial_emails_cron_worker_job_instances.rb new file mode 100644 index 0000000000000000000000000000000000000000..39517e5e54b923f081473e9177cea4c1d21490ad --- /dev/null +++ b/db/migrate/20241002181047_remove_abandoned_trial_emails_cron_worker_job_instances.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class RemoveAbandonedTrialEmailsCronWorkerJobInstances < Gitlab::Database::Migration[2.2] + DEPRECATED_JOB_CLASSES = %w[Emails::AbandonedTrialEmailsCronWorker] + + milestone '17.5' + disable_ddl_transaction! + + def up + # If the job has been scheduled via `sidekiq-cron`, we must also remove + # it from the scheduled worker set using the key used to define the cron + # schedule in config/initializers/1_settings.rb. + # See the key from removal in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/149709 + job_to_remove = Sidekiq::Cron::Job.find('abandoned_trial_emails') + # The job may be removed entirely: + job_to_remove.destroy if job_to_remove + + # Removes scheduled instances from Sidekiq queues + sidekiq_remove_jobs(job_klasses: DEPRECATED_JOB_CLASSES) + end + + def down + # This migration removes any instances of deprecated workers and cannot be undone. + end +end diff --git a/db/schema_migrations/20241002181047 b/db/schema_migrations/20241002181047 new file mode 100644 index 0000000000000000000000000000000000000000..7249087421da7705d83e6604e0bd15b60fd55f61 --- /dev/null +++ b/db/schema_migrations/20241002181047 @@ -0,0 +1 @@ +74d26979d8572457a0e027ab7ff95cd5228dc33c7ca174f3b1fa1370d0a38d42 \ No newline at end of file diff --git a/ee/app/workers/all_queues.yml b/ee/app/workers/all_queues.yml index ccfff107dc232e6b807c4512cee71d3574b480f5..8206ed4da9822dcfc83e16bd642b7a2fbd87af77 100644 --- a/ee/app/workers/all_queues.yml +++ b/ee/app/workers/all_queues.yml @@ -246,15 +246,6 @@ :weight: 1 :idempotent: true :tags: [] -- :name: cronjob:emails_abandoned_trial_emails_cron - :worker_name: Emails::AbandonedTrialEmailsCronWorker - :feature_category: :onboarding - :has_external_dependencies: false - :urgency: :low - :resource_boundary: :unknown - :weight: 1 - :idempotent: false - :tags: [] - :name: cronjob:geo_metrics_update :worker_name: Geo::MetricsUpdateWorker :feature_category: :geo_replication diff --git a/ee/app/workers/emails/abandoned_trial_emails_cron_worker.rb b/ee/app/workers/emails/abandoned_trial_emails_cron_worker.rb deleted file mode 100644 index 643813a87de1babd3606689bdcfa9644882e7064..0000000000000000000000000000000000000000 --- a/ee/app/workers/emails/abandoned_trial_emails_cron_worker.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Emails - class AbandonedTrialEmailsCronWorker # rubocop:disable Scalability/IdempotentWorker - include ApplicationWorker - - data_consistency :always - - # rubocop:disable Scalability/CronWorkerContext - # This worker does not perform work scoped to a context - include CronjobQueue - # rubocop:enable Scalability/CronWorkerContext - - feature_category :onboarding - - def perform; end - end -end diff --git a/ee/spec/workers/emails/abandoned_trial_emails_cron_worker_spec.rb b/ee/spec/workers/emails/abandoned_trial_emails_cron_worker_spec.rb deleted file mode 100644 index 2ca8c6da0ad34b912ea604b65a4cbc7e71826d5f..0000000000000000000000000000000000000000 --- a/ee/spec/workers/emails/abandoned_trial_emails_cron_worker_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Emails::AbandonedTrialEmailsCronWorker, :saas, feature_category: :onboarding do - describe "#perform" do - subject(:worker) { described_class.new } - - it 'does not deliver abandoned trial notification' do - expect(Notify).not_to receive(:abandoned_trial_notification) - - worker.perform - end - end -end