Ruby Rails - Sidekiq 不发送电子邮件,继续锁定计划任务

Ruby on Rails - Sidekiq not sending email, stay lock up in schedule tasks

我有一个联系表格,可以将包含这些字段的电子邮件发送到管理员电子邮件。我正在使用 Sidekiq 和 Redis。当我发送表单时,任务在 sidekiq 计划任务中保持锁定状态,永远不会发送。

有没有人遇到过这种情况?我已经尝试了很多方法来尝试解决这个问题,但没有成功。我配置有问题吗?

# app/mailers/contact_mailer.rb
class ContactMailer < ActionMailer::Base
  default from: "Facens Liga <no-reply@facens.br>"
  def create(contact)
    @contact = contact
    mail(to: "felipe.marcon@atua.ag", subject: "Contato Através do Site")

  end
end


# config/initializers/sidekiq.rb
require 'sidekiq'
require 'sidekiq-status'

Sidekiq.configure_server do |config|
  config.redis = { url: 'redis://127.0.0.1:6379/6', namespace: 'facenliga' }
end

Sidekiq.configure_client do |config|
  config.redis = { url: 'redis://127.0.0.1:6379/6', namespace: 'facensliga' }
end

# config/sidekiq.yml
:pidfile: tmp/pids/sidekiq.pid
:logfile: ./log/sidekiq.log
:queues:
  - default
  - mailers
production:
  :concurrency: 25
staging:
  :concurrency: 15
development:
  :concurrency: 25

我希望有人能帮助我。谢谢。

问题出在您的命名空间上。不要使用名称空间,正如我去年在我的博客中所写的那样。

The redis-namespace gem allows you to share a Redis database among several applications by prefixing every key with a namespace but it's a terrible hack that no one should use. Redis already has a native solution if you want to share a Redis instance: databases. The default database is 0. Here's how to point Sidekiq to use database 1 instead:

https://www.mikeperham.com/2017/04/10/migrating-from-redis-namespace/