I have a rails app in which I have a method where I send a lot of emails. I would like to perform this action asynchronously. To do it I've tried to use Sidekiq, but I can't get it to work properly - it doesn't send any emails.
Sending email worked before, so I'm certain that my email settings is set ut correctly.
In my gemfile I have this:
gem 'sidekiq'
And I have run bundle install. I have also install redis, followed the instructions on RailsCasts #366.
I have started sidekiq with the following command: bundle exec sidekiq, this resulted in what can be seen in the image below:

In application.rb I have the following:
config.active_job.queue_adapter = :sidekiq
And I try to send the emails like this:
Mailer.deliver_new_competition_notification(member.user, @competition).deliver_later!
I don't get any errors, but the emails never gets sent.
So, have I missed something?
You need to bootup sidekiq with the mailer queue for it to pick up these jobs:
bundle exec sidekiq -q default -q mailers
The Sidekiq Wiki goes over the scenarios in detail here.
Also you can modify the config/sidekiq.yml:
---
:concurrency: 25
:pidfile: ./tmp/pids/sidekiq.pid
:logfile: ./log/sidekiq.log
:queues:
- default
- mailers
And run sidekiq -C config/sidekiq.yml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With