Merge branch 'issues/15127' into 'master'

fix #15127 ActiveJob::DeserializationError thrown

`send_devise_notification` pre-maturely enqueued the task when the user instance
has not yet been committed into the database, causing a record-not-found in the
other sidekiq process.

`devise-async` has already been taking care of asynchronous mail sending, we just
need to run it inside queue `mailers` instead of `mailer` to enable it.

The implementation of `devise-async` enqueues the task in `after_commit` hook
which is the right way to do it.

See merge request !3647
This commit is contained in:
Stan Hu 2016-05-19 06:12:34 +00:00
commit 3656b5db07
2 changed files with 1 additions and 5 deletions

View file

@ -789,11 +789,6 @@ class User < ActiveRecord::Base
other.select(:id)])
end
# Added according to https://github.com/plataformatec/devise/blob/7df57d5081f9884849ca15e4fde179ef164a575f/README.md#activejob-integration
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
def ensure_external_user_rights
return unless self.external?

View file

@ -1 +1,2 @@
Devise::Async.backend = :sidekiq
Devise::Async.queue = :mailers