Home > Software design >  How to check if a user still have a queue running
How to check if a user still have a queue running

Time:07-13

I'm working on a small project using Laravel 9 and I'm using Queues to import CSVs file.

each user can import his own contact list as a CSV file. I would like to know if there is any way to prevent users from uploading there CSV files again since the first Queue, or at least how can I check if a user have a queue still running didn't finished yet.

Thank you

CodePudding user response:

You should be able to store a table of import tasks executed by users and refer to that when deciding on whether there are any running tasks.

You might be able to use the jobs table (with some tweaks on the information that you save within a job) if you're using a database queue connection but that would lock you into that driver.

CodePudding user response:

I found the solution, all what I have to do is to use a Queue middle ware and with return [new WithoutOverlapping($this->user->id)];

Check the link bellow

  • Related