Category: Laravel

This job will check the order status after an hour and cancel it automatically if it wasn't completed by then. Let's see how such job can be dispatched from the controller action: By chaining the delay(3600) method after dispatch(), the MonitorPendingOrder job will be pushed to the queue with a delay of 3600 seconds (1 hour); workers will not process this job before the hour passes.

If you want to delay jobs for more, you'll need to delay for 15 minutes first and then keep releasing the job back to queue using release().

To do this, we're going to delay dispatching the job for 15 minutes instead of an hour: When the job runs, we want to check if an hour has passed and cancel the order.

We need to make sure our job has enough $tries to run 4 times: This job will now run: If the user confirmed or canceled the order say after 20 minutes, the job will be deleted from the queue when it runs on the attempt at 30 minutes and no SMS will be sent.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners