Home > OS >  Does a queued job in Laravel get stopped if deleted from database?
Does a queued job in Laravel get stopped if deleted from database?

Time:11-05

I am trying to implement a feature when a user deletes their account, it activates a job that queues in a week, but the user is allowed to cancel this queue if they decide to keep their account. However, I noticed when I deleted the job from the database, the job didn't activate. Is this the right way to cancel the queued job?

I am using the database option for my QUEUE_CONNECTION=database in my .env file. I also have a jobs table.

CodePudding user response:

To remove all failed jobs from database use:

php artisan queue:flush

To remove a failed job from database use:

php artisan queue:forget your_failed_job_uid

To remove all jobs from database use:

php artisan queue:clear

As a note: your system will deal with queues depend on queue configuration like delayed job or a failed job retried 3 times and after each one there is a delay.

  • Related