Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TheoR's avatar
Level 14

Queue ShouldBeUniqueUntilProcessing

So, here is my situation: I have a job that gets fired when a table is updated that updates a REDIS cache instance, then sends websocket notifications out that the table was updated. If three people update this table at the same time and all three fire the job. I don't want to rebuild the cache and notify the users three times, just once.

So I added the contract "ShouldBeUniqueUntilProcessing". Which seems to work, but it also seems, at times, to keep the job from being dispatched when I think it should. Am I understanding that contract right?

What I want to accomplish: Once the job is dispatched, another can be put on the queue, even if the dispatched job isn't complete. But if there is already one on the queue waiting to be dispatched, then there is no need for another to be put on the queue.

0 likes
1 reply
laracoft's avatar

Once the job is dispatched, another can be put on the queue, even if the dispatched job isn't complete. But if there is already one on the queue waiting to be dispatched, then there is no need for another to be put on the queue.

I'm trying to do the same too, also noticed something is stopping my job from going onto the queue. I wonder where ShouldBeUniqueUntilProcessing manages its state

Please or to participate in this conversation.