i'm working on rails application sends emails in background using sidekiq , mandrill. in application have 2 queues, 1 user interactions service (irrelevant) , second mailer queue. mailer queue used 2 mailers: 1 managing user profile , other 1 interactions our service (irrelevant).
today noticed users not getting emails few days except confirmation email sent devise.
the other queue working flawlessly , doesn't have problems. (so maybe sidekiq configuration not problem).
for example lets take usermailer notifies user of successful profile update:
user_mailer.rb
def update_user(user) @user = user mail(:to => user.email) end
user_profile_controller.rb
def update_resource(user) user.save usermailer.update_user(user).deliver_later(wait: 1.minute) end
when tried testing function deliver_now instead of deliver_later worked , mail sent (so connection mandrill working). when test function is, job being added mailer queue. when it's time send email disappears queue without sending email , without leaving exceptions in logs.
i can see appear in sidekiq web ui , disappear.
i guess confirmation email 1 being sent because isn't delayed, don't know why happenning.
everything working great on staging environment. difference it's working mailtrap , doesn't have jobs production.
some code might relevant:
production.rb
config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :user_name => 'xxx', :password => rails.application.secrets.smtp_password, :address => 'smtp.mandrillapp.com', :domain => config.app_domain, :port => 'xxx', :authentication => :login } ... config.action_mailer.default_url_options = { :host => config.app_domain, :protocol => 'https' } config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = false
application.rb
config.active_job.queue_adapter = :sidekiq
walked through these links without solution:
http://guides.rubyonrails.org/active_job_basics.html http://api.rubyonrails.org/classes/actionmailer/base.html
haven't found other links relevant issue.
- tried re-deploying
- tried restarting sidekiq
- tried restarting redis
- tried restarting server itself
- tried sending email console - successful
- tried sending email deliver_later(wait:1min) - unsuccessful
i'm suspecting has lack of memory on server. when increased memory on server , max_connections parameter on postgres, emails on queue supposed sent, delivered immediately
Comments
Post a Comment