Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 4.2 - Sidekiq not sending emails in development

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:

enter image description here

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?

like image 978
Anders Avatar asked Mar 01 '15 16:03

Anders


2 Answers

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.

like image 58
Anthony Avatar answered Sep 26 '22 05:09

Anthony


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

like image 37
Xan Admin Avatar answered Sep 23 '22 05:09

Xan Admin