【问题标题】:Sidekiq with Rails 4 on Cloud9 Dev and Heroku Production在 Cloud9 开发和 Heroku 生产上使用 Rails 4 的 Sidekiq
【发布时间】:2023-03-31 06:51:01
【问题描述】:

我只是不明白这是如何工作的,需要帮助。我做了什么……

我已经安装了 sidekiq gem,我已经添加到 application.rb 文件中

class Application < Rails::Application
  # ...
  config.active_job.queue_adapter = :sidekiq
end

我创建了一个 Job(不确定是否有必要,因为我现在只使用 ActionMailer)

rails generate job Example

我已将 #deliver_later 添加到 actionmailer

if po_collection.empty? == false
      VendorSender.open_order_sender(user, vendor, po_collection).deliver_later
end

我在这里遗漏了什么吗?我怎么知道它在工作?此外,服务器日志似乎正在运行,但我仍在等待发送电子邮件。

2016-09-30T14:11:21.109402+00:00 app[worker.1]: 
2016-09-30T14:11:21.109509+00:00 app[worker.1]: [ActiveJob] [ActionMailer::DeliveryJob] [9da34b85-8695-4a0f-939f-c1614b141cb7] Performed ActionMailer::DeliveryJob from Sidekiq(mailers) in 1205.49ms
2016-09-30T14:11:21.110374+00:00 app[worker.1]: 3 TID-otddzp9gg ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper JID-3d86866a3e1d54bb0486c63c INFO: done: 3.415 sec
2016-09-30T14:11:21.111969+00:00 app[worker.1]: [ActiveJob] [ActionMailer::DeliveryJob] [e70249d4-81ff-4ca3-8e8a-d8534cd59370] 
2016-09-30T14:11:21.111970+00:00 app[worker.1]: Sent mail to private@private.com (939.1ms)
2016-09-30T14:11:21.112015+00:00 app[worker.1]: [ActiveJob] [ActionMailer::DeliveryJob] [e70249d4-81ff-4ca3-8e8a-d8534cd59370] Date: Fri, 30 Sep 2016 07:11:20 -0700

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 heroku sidekiq


    【解决方案1】:

    你必须跑

    bundle exec sidekiq
    

    来自您的 rails 项目的根目录。如果它正在工作,您将在该窗口中看到正在处理的作业。

    【讨论】:

    • 查看我的服务器日志。看起来它显示在我的服务器日志中而不是 bundle exec sidekiq 然后显示在终端中
    • 这实际上让我想通了
    猜你喜欢
    • 2014-02-03
    • 2012-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-06
    • 2016-07-02
    • 2013-05-15
    • 2013-06-24
    相关资源
    最近更新 更多