Commit 44035b3c authored by Fabio Pitino's avatar Fabio Pitino

Merge branch 'sh-fix-delivery-job-deprecation' into 'master'

Fix deprecated DeliveryJob message

Closes #208305

See merge request gitlab-org/gitlab!36669
parents c60e640c 73cbf50e
...@@ -158,6 +158,8 @@ module Gitlab ...@@ -158,6 +158,8 @@ module Gitlab
# Webpack dev server configuration is handled in initializers/static_files.rb # Webpack dev server configuration is handled in initializers/static_files.rb
config.webpack.dev_server.enabled = false config.webpack.dev_server.enabled = false
config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
# Enable the asset pipeline # Enable the asset pipeline
config.assets.enabled = true config.assets.enabled = true
......
...@@ -186,7 +186,7 @@ user.save ...@@ -186,7 +186,7 @@ user.save
Which would return: Which would return:
```ruby ```ruby
Enqueued ActionMailer::DeliveryJob (Job ID: 05915c4e-c849-4e14-80bb-696d5ae22065) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007f42d8ccebe8 @uri=#<URI::GID gid://gitlab/User/1>> Enqueued ActionMailer::MailDeliveryJob (Job ID: 05915c4e-c849-4e14-80bb-696d5ae22065) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007f42d8ccebe8 @uri=#<URI::GID gid://gitlab/User/1>>
=> true => true
``` ```
......
...@@ -38,7 +38,7 @@ Example log output: ...@@ -38,7 +38,7 @@ Example log output:
```json ```json
{"severity":"INFO","time":"2020-06-08T14:37:37.892Z","class":"AdminEmailsWorker","args":["[FILTERED]","[FILTERED]","[FILTERED]"],"retry":3,"queue":"admin_emails","backtrace":true,"jid":"9e35e2674ac7b12d123e13cc","created_at":"2020-06-08T14:37:37.373Z","meta.user":"root","meta.caller_id":"Admin::EmailsController#create","correlation_id":"37D3lArJmT1","uber-trace-id":"2d942cc98cc1b561:6dc94409cfdd4d77:9fbe19bdee865293:1","enqueued_at":"2020-06-08T14:37:37.410Z","pid":65011,"message":"AdminEmailsWorker JID-9e35e2674ac7b12d123e13cc: done: 0.48085 sec","job_status":"done","scheduling_latency_s":0.001012,"redis_calls":9,"redis_duration_s":0.004608,"redis_read_bytes":696,"redis_write_bytes":6141,"duration_s":0.48085,"cpu_s":0.308849,"completed_at":"2020-06-08T14:37:37.892Z","db_duration_s":0.010742} {"severity":"INFO","time":"2020-06-08T14:37:37.892Z","class":"AdminEmailsWorker","args":["[FILTERED]","[FILTERED]","[FILTERED]"],"retry":3,"queue":"admin_emails","backtrace":true,"jid":"9e35e2674ac7b12d123e13cc","created_at":"2020-06-08T14:37:37.373Z","meta.user":"root","meta.caller_id":"Admin::EmailsController#create","correlation_id":"37D3lArJmT1","uber-trace-id":"2d942cc98cc1b561:6dc94409cfdd4d77:9fbe19bdee865293:1","enqueued_at":"2020-06-08T14:37:37.410Z","pid":65011,"message":"AdminEmailsWorker JID-9e35e2674ac7b12d123e13cc: done: 0.48085 sec","job_status":"done","scheduling_latency_s":0.001012,"redis_calls":9,"redis_duration_s":0.004608,"redis_read_bytes":696,"redis_write_bytes":6141,"duration_s":0.48085,"cpu_s":0.308849,"completed_at":"2020-06-08T14:37:37.892Z","db_duration_s":0.010742}
{"severity":"INFO","time":"2020-06-08T14:37:37.894Z","class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ActionMailer::DeliveryJob","queue":"mailers","args":["[FILTERED]"],"retry":3,"backtrace":true,"jid":"e47a4f6793d475378432e3c8","created_at":"2020-06-08T14:37:37.884Z","meta.user":"root","meta.caller_id":"AdminEmailsWorker","correlation_id":"37D3lArJmT1","uber-trace-id":"2d942cc98cc1b561:29344de0f966446d:5c3b0e0e1bef987b:1","enqueued_at":"2020-06-08T14:37:37.885Z","pid":65011,"message":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper JID-e47a4f6793d475378432e3c8: start","job_status":"start","scheduling_latency_s":0.009473} {"severity":"INFO","time":"2020-06-08T14:37:37.894Z","class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ActionMailer::MailDeliveryJob","queue":"mailers","args":["[FILTERED]"],"retry":3,"backtrace":true,"jid":"e47a4f6793d475378432e3c8","created_at":"2020-06-08T14:37:37.884Z","meta.user":"root","meta.caller_id":"AdminEmailsWorker","correlation_id":"37D3lArJmT1","uber-trace-id":"2d942cc98cc1b561:29344de0f966446d:5c3b0e0e1bef987b:1","enqueued_at":"2020-06-08T14:37:37.885Z","pid":65011,"message":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper JID-e47a4f6793d475378432e3c8: start","job_status":"start","scheduling_latency_s":0.009473}
{"severity":"INFO","time":"2020-06-08T14:39:50.648Z","class":"NewIssueWorker","args":["455","1"],"retry":3,"queue":"new_issue","backtrace":true,"jid":"a24af71f96fd129ec47f5d1e","created_at":"2020-06-08T14:39:50.643Z","meta.user":"root","meta.project":"h5bp/html5-boilerplate","meta.root_namespace":"h5bp","meta.caller_id":"Projects::IssuesController#create","correlation_id":"f9UCZHqhuP7","uber-trace-id":"28f65730f99f55a3:a5d2b62dec38dffc:48ddd092707fa1b7:1","enqueued_at":"2020-06-08T14:39:50.646Z","pid":65011,"message":"NewIssueWorker JID-a24af71f96fd129ec47f5d1e: start","job_status":"start","scheduling_latency_s":0.001144} {"severity":"INFO","time":"2020-06-08T14:39:50.648Z","class":"NewIssueWorker","args":["455","1"],"retry":3,"queue":"new_issue","backtrace":true,"jid":"a24af71f96fd129ec47f5d1e","created_at":"2020-06-08T14:39:50.643Z","meta.user":"root","meta.project":"h5bp/html5-boilerplate","meta.root_namespace":"h5bp","meta.caller_id":"Projects::IssuesController#create","correlation_id":"f9UCZHqhuP7","uber-trace-id":"28f65730f99f55a3:a5d2b62dec38dffc:48ddd092707fa1b7:1","enqueued_at":"2020-06-08T14:39:50.646Z","pid":65011,"message":"NewIssueWorker JID-a24af71f96fd129ec47f5d1e: start","job_status":"start","scheduling_latency_s":0.001144}
``` ```
......
...@@ -26,9 +26,9 @@ module Gitlab ...@@ -26,9 +26,9 @@ module Gitlab
job = ::Marginalia::Comment.marginalia_job job = ::Marginalia::Comment.marginalia_job
# We are using 'Marginalia::SidekiqInstrumentation' which does not support 'ActiveJob::Base'. # We are using 'Marginalia::SidekiqInstrumentation' which does not support 'ActiveJob::Base'.
# Gitlab also uses 'ActionMailer::DeliveryJob' which inherits from ActiveJob::Base. # Gitlab also uses 'ActionMailer::MailDeliveryJob' which inherits from ActiveJob::Base.
# So below condition is used to return metadata for such jobs. # So below condition is used to return metadata for such jobs.
if job && job.is_a?(ActionMailer::DeliveryJob) if job.is_a?(ActionMailer::MailDeliveryJob) || job.is_a?(ActionMailer::DeliveryJob)
{ {
"class" => job.arguments.first, "class" => job.arguments.first,
"jid" => job.job_id "jid" => job.job_id
......
...@@ -38,26 +38,26 @@ module NotificationHelpers ...@@ -38,26 +38,26 @@ module NotificationHelpers
end end
def expect_delivery_jobs_count(count) def expect_delivery_jobs_count(count)
expect(ActionMailer::DeliveryJob).to have_been_enqueued.exactly(count).times expect(ActionMailer::MailDeliveryJob).to have_been_enqueued.exactly(count).times
end end
def expect_no_delivery_jobs def expect_no_delivery_jobs
expect(ActionMailer::DeliveryJob).not_to have_been_enqueued expect(ActionMailer::MailDeliveryJob).not_to have_been_enqueued
end end
def expect_any_delivery_jobs def expect_any_delivery_jobs
expect(ActionMailer::DeliveryJob).to have_been_enqueued.at_least(:once) expect(ActionMailer::MailDeliveryJob).to have_been_enqueued.at_least(:once)
end end
def have_enqueued_email(*args, mailer: "Notify", mail: "", delivery: "deliver_now") def have_enqueued_email(*args, mailer: "Notify", mail: "", delivery: "deliver_now")
have_enqueued_job(ActionMailer::DeliveryJob).with(mailer, mail, delivery, *args) have_enqueued_job(ActionMailer::MailDeliveryJob).with(mailer, mail, delivery, args: args)
end end
def expect_enqueud_email(*args, mailer: "Notify", mail: "", delivery: "deliver_now") def expect_enqueud_email(*args, mailer: "Notify", mail: "", delivery: "deliver_now")
expect(ActionMailer::DeliveryJob).to have_been_enqueued.with(mailer, mail, delivery, *args) expect(ActionMailer::MailDeliveryJob).to have_been_enqueued.with(mailer, mail, delivery, args: args)
end end
def expect_not_enqueud_email(*args, mailer: "Notify", mail: "") def expect_not_enqueud_email(*args, mailer: "Notify", mail: "")
expect(ActionMailer::DeliveryJob).not_to have_been_enqueued.with(mailer, mail, *args, any_args) expect(ActionMailer::MailDeliveryJob).not_to have_been_enqueued.with(mailer, mail, args: any_args)
end end
end end
...@@ -19,7 +19,7 @@ RSpec.describe 'Every Sidekiq worker' do ...@@ -19,7 +19,7 @@ RSpec.describe 'Every Sidekiq worker' do
file_worker_queues = Gitlab::SidekiqConfig.worker_queues.to_set file_worker_queues = Gitlab::SidekiqConfig.worker_queues.to_set
worker_queues = Gitlab::SidekiqConfig.workers.map(&:queue).to_set worker_queues = Gitlab::SidekiqConfig.workers.map(&:queue).to_set
worker_queues << ActionMailer::DeliveryJob.new.queue_name worker_queues << ActionMailer::MailDeliveryJob.new.queue_name
worker_queues << 'default' worker_queues << 'default'
missing_from_file = worker_queues - file_worker_queues missing_from_file = worker_queues - file_worker_queues
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment