Enqueue RefreshProductsCacheJob with lower than default priority

This commit is contained in:
Rohan Mitchell
2016-02-05 14:57:31 +11:00
parent 98961fef74
commit 687fb6f0aa
2 changed files with 7 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ module OpenFoodNetwork
end
def self.enqueue_job(distributor, order_cycle)
Delayed::Job.enqueue RefreshProductsCacheJob.new distributor.id, order_cycle.id
Delayed::Job.enqueue RefreshProductsCacheJob.new(distributor.id, order_cycle.id), priority: 10
end
end
end

View File

@@ -13,6 +13,12 @@ module OpenFoodNetwork
ProductsCacheRefreshment.refresh distributor, order_cycle
end.to enqueue_job RefreshProductsCacheJob
end
it "enqueues the job with a lower than default priority" do
ProductsCacheRefreshment.refresh distributor, order_cycle
job = Delayed::Job.last
expect(job.priority).to be > Delayed::Worker.default_priority
end
end
describe "when there is an enqueued task, and it is running" do