Sometimes a non-trivial Queue operation can occasionally be triggered more than once before the first one is complete, which in some cases would make working the second queue redundant/waste of resources. Does Laravel has a Queue driver agnostic solution (e.g. redis, pheanstalk) to ensure unique queues? It looked "cheap" to do this in a Redis Queue, but if I needed it in any Queue driver, would it be an expensive check?
For example if Queue::push('FooQHandler@rebuildFooCache',['foo_id'=>12]);
is called twice and the queue is logged, there could be the following in the queue:
FooQHandler@rebuildFooCache, [foo_id=>10] <-- next to be worked by queue
FooQHandler@rebuildFooCache, [foo_id=>11]
FooQHandler@rebuildFooCache, [foo_id=>12]
FooQHandler@laySomeBricks, [foo_id=>10]
FooQHandler@rebuildFooCache, [foo_id=>14]
FooQHandler@rebuildFooCache, [foo_id=>12] <-- new duplicate
So for me it would be cool if something like this existed:
Queue::push('FooQHandler@rebuildFooCache',['foo_id'=>12])->unique();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community