开信刀不与sidekiq和sidetiq合作

时间:2016-04-20 18:04:59

标签: ruby-on-rails sidekiq

我正在使用sidekiq和sidetiq每分钟或每天安排电子邮件。

我想测试电子邮件,但letter_opener似乎没有回复它。

我的工作人员看起来像

class EmailWorker
  # Set the Queue as Default
   include Sidekiq::Worker
   include Sidetiq::Schedulable

  # Job will be performed daily. Frequency can be changed using following code: 
  recurrence { minutely(1) }

 def perform()
    bookings = BookingRequest.where("end_date = ?", DateTime.yesterday)
    if bookings.present?
        bookings.each do |booking|
            BookingMailer.review_to_customer(booking).deliver_now
        end
    end
  end
end

我的Sidekiq流程看起来像

2016-04-20T17:53:24.062Z 22421 TID-3q3yo INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
2016-04-20T17:53:24.063Z 22421 TID-3q3yo INFO: Starting processing, hit Ctrl-C to stop
2016-04-20T17:54:00.444Z 22421 TID-qcaso INFO: [Sidetiq] Enqueue: EmailWorker (at: 1461174900.0) (last: 1461174840.0)
2016-04-20T17:54:13.424Z 22421 TID-tgn48 EmailWorker JID-523715b3d33a85052c3ae2c5 INFO: start
2016-04-20T17:54:13.453Z 22421 TID-tgn48 EmailWorker JID-523715b3d33a85052c3ae2c5 INFO: done: 0.029 sec
2016-04-20T17:55:00.473Z 22421 TID-qcaso INFO: [Sidetiq] Enqueue: EmailWorker (at: 1461174960.0) (last: 1461174900.0)
2016-04-20T17:56:00.501Z 22421 TID-qcaso INFO: [Sidetiq] Enqueue: EmailWorker (at: 1461175020.0) (last: 1461174960.0)
2016-04-20T17:56:05.223Z 22421 TID-1ivh1c EmailWorker JID-459aaa9048dc3a7ecc8aba98 INFO: start
2016-04-20T17:56:05.226Z 22421 TID-1ivh1c EmailWorker JID-459aaa9048dc3a7ecc8aba98 INFO: done: 0.002 sec
2016-04-20T17:57:00.533Z 22421 TID-qcaso INFO: [Sidetiq] Enqueue: EmailWorker (at: 1461175080.0) (last: 1461175020.0)

0 个答案:

没有答案