Search code examples
ruby-on-rails-3devisesidekiq

Background mailing through sidekiq and devise-async, queue fills up but mails aren't processed


I'm currently building a rails platform and I've used devise for authentication and now want to move the default devise emails into a background process using sidekiq. I'm using devise-async for this and have done the following:

Added the devise_async.rb file:

#config/initializers/devise_async.rb
Devise::Async.backend = :sidekiq

Added the async command to the devise model:

#user.rb
devise :database_authenticatable, :async #etc.

The versions of the gems are the following:

Devise 2.1.2
Devise-async 0.4.0
Sidekiq 2.5.3

The issue that I'm having is that the emails are passed in the sidekiq queue but the workers never execute sending the emails. I've also looked at devise async not working with sidekiq and he seemed to have the same problem. But I don't think I have an issue with the hostname command.

Any thoughts on the issue?


Solution

  • The answer is rather simple. You just need to tell sidekiq to use the mailer queue, by starting sidekiq with bundle exec sidekiq -q mailer. That way the mailer queue will be processed, without the option sidekiq will simply rely on the default queue.