ruby on rails - Why Sidekiq 4 does not work with mailer correctly? -
i'm writing project rails 4.2.5, sidekiq 4.0.2 , sidekiq_mailer 0.0.8. i'm developing feature send emails asynchronously.
so, here mailer:
class usermailer < actionmailer::base include sidekiq::mailer sidekiq_options queue: 'mailer', backtrace: true default from: '<mail_from>' def one_c_client_problems_email(message) @message = message email_subject = "subj" mail(to: '<mail_to>', subject: email_subject) end end sidekiq initializer:
require 'sidekiq' require 'sidekiq/web' sidekiq::web.use(rack::auth::basic) |user, password| [user, password] == ['<login>', '<pass>'] end schedule_file = 'config/schedule.yml' if file.exists?(schedule_file) && sidekiq.server? sidekiq::cron::job.load_from_hash yaml.load_file(schedule_file) end sidekiq config file:
--- :concurrency: 10 :pidfile: tmp/pids/sidekiq.pid :logfile: log/sidekiq.log :queues: - default - mailer (i kick off sidekiq bundle exec sidekiq -c config/sidekiq.yml command)
in application.rb, sidekiq configured default active job adapter:
config.active_job.queue_adapter = :sidekiq when try send letter rails console without sidekiq:
usermailer.one_c_client_problems_email('message').deliver! it works!
when try send async email sidekiq:
usermailer.one_c_client_problems_email('message').deliver nothing happens...
p.s. periodical jobs works fine , non-mail jobs works fine. why not working? please, help!
no queues in sidekiq ui:
but ui see queues should initialized:
sidekiq logs empty (when run sidekiq sidekiq -q default -q mailers console output empty too). see in logs:
2016-03-17t09:26:33.926z 1852 tid-ovlvb5ofs info: booting sidekiq 4.0.2 redis options {:url=>nil} 2016-03-17t09:26:33.954z 1852 tid-ovlvb5ofs info: cron jobs - add job name: 1c client. update users our db. every hour 2016-03-17t09:26:33.956z 1852 tid-ovlvb5ofs info: cron jobs - add job name: survey reminder. remind users unfilled surveys. 9am every day 2016-03-17t09:26:33.995z 1852 tid-ovlvb5ofs info: cron jobs - add job name: 1c client. update users our db. every hour 2016-03-17t09:26:33.997z 1852 tid-ovlvb5ofs info: cron jobs - add job name: survey reminder. remind users unfilled surveys. 9am every day 2016-03-17t09:26:36.245z 1852 tid-ovlvb5ofs info: running in ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15] 2016-03-17t09:26:36.245z 1852 tid-ovlvb5ofs info: see license , lgpl-3.0 licensing details. 2016-03-17t09:26:36.245z 1852 tid-ovlvb5ofs info: upgrade sidekiq pro more features , support: http://sidekiq.org 2016-03-17t09:26:36.245z 1852 tid-ovlvb5ofs info: starting processing, hit ctrl-c stop why in logs booting sidekiq 4.0.2 redis options {:url=>nil} redis url nil? why sidekiq not see redis?
in gemfile line gem 'rspec-sidekiq' should in group :test.
this gem changes sidekiq configurations , works bad sidekiq 4.x.x versions.
group :test gem 'rspec-sidekiq' end but still don't know why redis url nil in logs...
also, sidekiq 4.0.2 not need sidekiq_mailer gem async mail delivering.


Comments
Post a Comment