From 59239af94f0482707d0195097e4b6ce994840346 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 14 Aug 2023 15:10:02 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/workers/all_queues.yml | 9 ++++++ .../custom_email_verification_cleanup_worker.rb | 36 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 app/workers/service_desk/custom_email_verification_cleanup_worker.rb (limited to 'app/workers') diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index c3200cdfe0d..1664add1ac9 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -822,6 +822,15 @@ :weight: 1 :idempotent: false :tags: [] +- :name: cronjob:service_desk_custom_email_verification_cleanup + :worker_name: ServiceDesk::CustomEmailVerificationCleanupWorker + :feature_category: :service_desk + :has_external_dependencies: false + :urgency: :low + :resource_boundary: :unknown + :weight: 1 + :idempotent: true + :tags: [] - :name: cronjob:ssh_keys_expired_notification :worker_name: SshKeys::ExpiredNotificationWorker :feature_category: :compliance_management diff --git a/app/workers/service_desk/custom_email_verification_cleanup_worker.rb b/app/workers/service_desk/custom_email_verification_cleanup_worker.rb new file mode 100644 index 00000000000..6434b9b09bb --- /dev/null +++ b/app/workers/service_desk/custom_email_verification_cleanup_worker.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module ServiceDesk + # Marks custom email verifications as failed when + # verification has started and timeframe to ingest + # the verification email has closed. + # + # This ensures we can finish the verification process and send verification result emails + # even when we did not receive any verification email. + class CustomEmailVerificationCleanupWorker + include ApplicationWorker + include CronjobQueue + + idempotent! + + data_consistency :sticky + feature_category :service_desk + + def perform + # Limit ensures we have 50ms per verification before another job gets scheduled. + collection = CustomEmailVerification.started.overdue.limit(2_400) + + collection.find_each do |verification| + with_context(project: verification.project) do + CustomEmailVerifications::UpdateService.new( + project: verification.project, + current_user: nil, + params: { + mail: nil + } + ).execute + end + end + end + end +end -- cgit v1.2.3