Reputation: 3618
I've set Devise to send emails asynchronously, like so:
class User < ApplicationRecord
...
def send_devise_notification(notification, *args)
DeviseMailerJob.perform_now(devise_mailer, notification, id, *args)
end
end
class DeviseMailerJob < ApplicationJob
queue_as :mailers
def perform(devise_mailer, method, user_id, *args)
user = User.find(user_id)
devise_mailer.send(method, user, *args).deliver_now
end
end
My sidekiq.yml
looks like this:
---
:concurrency: 5
:queues:
- mailers
I can go to the sign up page, sign up and I will see that everything seems ok in the logs:
2018-10-09T10:02:27.793848+00:00 app[web.1]: I,
[2018-10-09T10:02:27.793770 #4] INFO -- :
[646a58f7-9588-4a1f-a258-9fbede3cf87d] [ActiveJob] [DeviseMailerJob]
[5ceac77e-d498-4436-8f12-7cd4aff2c004] Performed DeviseMailerJob (Job ID:
5ceac77e-d498-4436-8f12-7cd4aff2c004) from Sidekiq(mailers) in 3301.06ms
But the job does not show up in the Sidekiq dashboard. I do receive the confirmation email however. So the job does get processed. Only, I cannot be sure that Sidekiq is handling it.
Looking at the Heroku logs, I cannot see any logs from Sidekiq. On the dashboard, I would expect to see the 'processed' tally increment for every email that is sent. I'm not sure how to investigate this.
With Heroku, what's the best way of seeing wether or not the job is being handled by Sidekiq? Is there anything in my code to suggest that the job isn't being handled by Sidekiq?
Upvotes: 0
Views: 355
Reputation: 22208
You've explicitly told the code to execute immediately by calling perform_now:
DeviseMailerJob.perform_now
Upvotes: 1