summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-05-19 06:12:34 +0000
committerStan Hu <stanhu@gmail.com>2016-05-19 06:12:34 +0000
commit3656b5db071d13b23803a9cbf9347da34b19fb24 (patch)
tree8d8702e5c4d8377b0088baf63b2992da9268336c
parent4607323e130fe5b04e830f7a6de8083b070808f1 (diff)
parente4d9d4e55b67ab04e46ee3f72c5496f91687a205 (diff)
downloadgitlab-ce-3656b5db071d13b23803a9cbf9347da34b19fb24.tar.gz
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
-rw-r--r--app/models/user.rb5
-rw-r--r--config/initializers/devise_async.rb1
2 files changed, 1 insertions, 5 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 6a09b78455b..02e1f461fa6 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -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?
diff --git a/config/initializers/devise_async.rb b/config/initializers/devise_async.rb
index 05a1852cdbd..fa602cbe554 100644
--- a/config/initializers/devise_async.rb
+++ b/config/initializers/devise_async.rb
@@ -1 +1,2 @@
Devise::Async.backend = :sidekiq
+Devise::Async.queue = :mailers