5

红宝石版本:2.3.1

Sidekiq / Pro / Enterprise 版本:5.0

导轨:5.0.2

我已经按照本教程进行操作,所以我可以使用 sidekiq 在我的 rails api 应用程序中发送电子邮件。该应用程序与 Puma 一起发布在 AWS ElasticBeanstalk 上。

当用户注册时,他们应该会收到一封电子邮件(通过设计)。没有显示错误,在 sidekiq.log 中没有生成日志。我不知道发生了什么,电子邮件根本没有送达。

初始化器/devise_async.rb

Devise::Async.setup do |config|
  config.enabled = true
  config.backend = :sidekiq
  config.queue   = :default
end

初始化程序/sidekiq.rb

rails_root = Rails.root || File.dirname(__FILE__) + '/../..'
rails_env = Rails.env || 'development'
redis_config = YAML.load_file(rails_root.to_s + '/config/redis.yml')
redis_config.merge! redis_config.fetch(Rails.env, {})
redis_config.symbolize_keys!
Sidekiq.configure_server do |config|
  config.redis = { url: "redis://#{redis_config[:host]}:#{redis_config[:port]}/12" }
end
Sidekiq.configure_client do |config|
  config.redis = { url: "redis://#{redis_config[:host]}:#{redis_config[:port]}/12" }
end

配置/redis.yml

development:
 host: 'localhost'
 port: '6379'
test:
 host: 'localhost'
 port: '6379'
production:
 host: 'xxxxx-xxxx-xxx.xxxxxx.xx.0001.sae1.cache.amazonaws.com'
 port: '6379'

配置/sidekiq.yml

:concurrency: 5
:queues:
  - default

最后的 sidekiq 日志行:

2017-05-06T02:16:10.579Z 8388 TID-grwqwpuzw INFO: Received USR1, no longer accepting new work
2017-05-06T02:16:10.584Z 8399 TID-gp30plzqo INFO: Received USR1, no longer accepting new work

最后的 nginx 日志行:

172.31.14.103 - - [06/May/2017:02:20:51 +0000] "POST /v1/auth/ HTTP/1.1" 200 271 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36"

2017/05/06 02:16:22 [warn] 15902#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2017/05/06 02:16:22 [warn] 15909#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2017/05/06 02:16:22 [warn] 15950#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2017/05/06 02:16:22 [warn] 15957#0: conflicting server name "localhost" on 0.0.0.0:80, ignored

最后 puma 日志行:

[11765] - Gracefully shutting down workers...
[11765] === puma shutdown: 2017-05-06 02:16:23 +0000 ===
[11765] - Goodbye!
=== puma startup: 2017-05-06 02:16:26 +0000 ===
=== puma startup: 2017-05-06 02:16:26 +0000 ===
/var/app/current/app/serializers/notification_serializer.rb:20: warning: redefining `object_id' may cause serious problems
[16011] - Worker 0 (pid: 16014) booted, phase: 0

它在本地机器上运行良好。

你有什么想法吗?

4

0 回答 0