一尘不染

使用devise-async发送电子邮件不起作用(Rails / Sidekiq)

redis

我有sidekiq (2.15.2)devise (3.2.0)并且devise-async (0.9.0)在我的Rails应用程序中。

我试图devise-async接管发送电子邮件。但没有运气。我遵循了这样的指示

添加:asyncUser模型:

# models/user.rb
class User
  include Mongoid::Document
  devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, :async
end

创建一个初始化程序:

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

我尚未在邮件中进行任何自定义修改

# config/initializers/devise_async.rb
Devise.setup do |config|
  config.mailer_sender = "my@email.com"
  # config.mailer = "Devise::Mailer"
end

这是创建新帐户时控制台中显示的内容:

Started POST "/da/users" for 127.0.0.1 at 2014-05-29 14:42:07 +0200
Processing by RegistrationsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"wyIIRqVoYrXqbX/U+3PGyrYI/MIxcH1YErUQ7JWcfUs=", "user"=>{"company"=>"Some Company Ltd.", "email"=>"some@email.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Opret", "locale"=>"da"}
  MOPED: 127.0.0.1:27017 QUERY        database=mydb_development collection=users selector={"email"=>"some@email.com"} flags=[] limit=-1 skip=0 batch_size=nil fields={:_id=>1} runtime: 0.9300ms
  MOPED: 127.0.0.1:27017 QUERY        database=mydb_development collection=users selector={"$query"=>{"confirmation_token"=>"5bc925b83260b498dfc26e202c1403c39638527b62c85fec7e97c9f59d1f55d8"}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.8670ms
  MOPED: 127.0.0.1:27017 INSERT       database=mydb_development collection=users documents=[{"_id"=>BSON::ObjectId('53872b204368720748000000'), "email"=>"some@email.com", "encrypted_password"=>"$2a$10$6WQO8zK2Sl/HCPPYHIdKceKpaY9gH.LJZlRM8PA.6i2rePmI8C1Ii", "sign_in_count"=>0, "company"=>"Some Company Ltd", "confirmation_token"=>"5bc925b83260b498dfc26e202c1403c39638527b62c85fec7e97c9f59d1f55d8", "confirmation_sent_at"=>2014-05-29 12:42:08 UTC, "locale"=>"da", "timezone"=>"Europe/Copenhagen"}] flags=[]
                     COMMAND      database=mydb_development command={:getlasterror=>1, :w=>1} runtime: 1.0460ms
2014-05-29T12:42:08Z 1864 TID-oxcjnftnc INFO: Sidekiq client using redis://localhost:6379/0 with options {}
Redirected to http://localhost:3000/da/users/confirmation/new
Completed 302 Found in 1469ms

我的Sidekiq日志没有显示任何内容。

有任何想法吗?


阅读 367

收藏
2020-06-20

共1个答案

一尘不染

设置Devise::Async.queue = :default

2020-06-20