Want to access all of our courses? (36 h 00 min)
You also get:
Already a member? Login here
🧵 Question: How to Cancel a Delayed Job in Laravel?
Let’s say I allow users to schedule a job (like downloading their account data) that runs after N minutes/hours.
The job is queued with a delay (using delay() or Queue::later()), and stored in Redis or Database, depending on the config.
Now, if the user changes their mind and clicks "Cancel", I want to remove that scheduled job before it runs.
I know queue:forget is for failed jobs, but:
❓ What’s the recommended / optimized way in Laravel to cancel a scheduled (delayed) job before it's executed?
Any clean way to remove it using Laravel’s built-in features? Or do I need to manually remove it from Redis/database?
Thanks!
🧵 Question: How to Cancel a Delayed Job in Laravel?
Let’s say I allow users to schedule a job (like downloading their account data) that runs after N minutes/hours.
The job is queued with a delay (using delay() or Queue::later()), and stored in Redis or Database, depending on the config.
Now, if the user changes their mind and clicks "Cancel", I want to remove that scheduled job before it runs.
I know queue:forget is for failed jobs, but:
❓ What’s the recommended / optimized way in Laravel to cancel a scheduled (delayed) job before it's executed?
Any clean way to remove it using Laravel’s built-in features? Or do I need to manually remove it from Redis/database?
Thanks!