Class: Workarea::OrderReminder

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/workarea/order_reminder.rb

Instance Method Summary collapse

Instance Method Details

#performObject



5
6
7
8
9
10
11
12
13
14
# File 'app/workers/workarea/order_reminder.rb', line 5

def perform(*)
  # This while loop is necessary because
  # we're changing the count as we go
  while Order.need_reminding.any?
    Order.need_reminding.each_by(50) do |order|
      order.mark_as_reminded!
      Storefront::OrderMailer.reminder(order.id).deliver_now
    end
  end
end