Use ActiveJob instead of Resque directly

This allows us to directly pass entities to the job.
This commit is contained in:
Patrick Gansterer 2020-07-31 14:09:45 +02:00
parent 07c8393c8c
commit 47d9c79617
16 changed files with 76 additions and 73 deletions

View file

@ -260,7 +260,7 @@ class Order < ApplicationRecord
ordergroups.each(&:update_stats!)
# Notifications
Resque.enqueue(UserNotifier, FoodsoftConfig.scope, 'finished_order', self.id)
NotifyFinishedOrderJob.perform_later(self)
end
end
end

View file

@ -89,7 +89,7 @@ class Ordergroup < Group
update_balance!
# Notify only when order group had a positive balance before the last transaction:
if t.amount < 0 && self.account_balance < 0 && self.account_balance - t.amount >= 0
Resque.enqueue(UserNotifier, FoodsoftConfig.scope, 'negative_balance', self.id, t.id)
NotifyNegativeBalanceJob.perform_later(self, t)
end
t
end