Laravel Queue Delays Not Working

Posted on: 27/02/2019. Last updated at: 27/02/2019


This had me stupmed for several hours, Google searches only helped so much, however I should have paid more attention to the Laravel docs instead!

Before we start, I fell foul of the following in my .env file, where it says QUEUE_DRIVER=redis or sync etc, in Laravel 5.7 and onwards this has been changed to QUEUE_CONNECTION=redis instead.

I'm not sure why my .env had this wrong, but it's worth checking to see if yours is the same too. Dispatching events to the queue actually started working after i made this change, however the delays did not. Read on to find out why.

Queueing Notifications

As per the Laravel 5.7 docs: https://laravel.com/docs/5.7/notifications#queueing-notifications

if you want to push your notifications onto a queue, you need to add the ShouldQueue interface and Queuable trait on your notification class. Check out the example from the above link.

class InvoicePaid extends Notification implements ShouldQueue
{
use Queueable;
}

I was missing the "implements ShouldQueue" Interface. Once i added this, delays were working as expected!



Picture of Daniel Ord
Daniel Ord

Building things for the Web. Follow me on Twitter or checkout my GitHub.

More Posts

Cached values not showing in Redis
Recently I wasn't able to access any cached values in Redis. I knew the values were being saved, but no...
How to setup IP restriction in Laravel Horizon and avoid 403 access denied error
I show you how to setup IP address restriction for Larvel Horizon and how to avoid the 403 error on...
Perfect PageSpeed score using Bootstrap and mod_pagespeed
I've never really gave the PageSpeed score of the websites that i've built too much consideration, as long as they...
Can't write image data to path - Intervention Image
I recently came across the following error when using Intervention Image with Laravel 5.6: "Can't write image data to path...
How to set file permissions for Laravel 5 on mac OSX
Every time I do a fresh install of Laravel I always run into the same error where laravel.log couldn't be...

Other Categories