Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Jboomer's avatar

Larvel Redis Batches not running in queue

I have the weird issue with redis. If i dispatch the job on a particiular queeu in this case "redis-dev" it will run with out issue. If i bath the job the batch gets created in the database, the job gets created in redis i can see it. It alwys shows pending, and when i run php artisan queue:monitor redis-dev it says there are no jobs even though i can clearly see the job in redis and it shows pending. I am using AWS elasticache so i have heard that can have issues, but all my other jobs that are not batch jobs all work without an issue.

I have been at wits end for the better part of a week now without any progress any help would be appreciated.

0 likes
10 replies
Jboomer's avatar

Sorry here is my code:

For the batch i am building it like this:

$batch = Bus::batch($jobs) ->allowFailures() ->then(function (Batch $batch) { $batch->delete(); })->catch(function (Batch $batch, Throwable $e){ Log::error('The Job: ' . $batch->failedJobIds[0] . ' has failed.'); }) ->name('Test Jobs for redis') ->onQueue('{redis-dev}' ->dispatch();

my queues are setup like this:

connections' => [ 'redis-dev' => [ 'driver' => 'redis', 'connection' => 'default', 'queue' => 'redis-dev', 'retry_after' => 1200, 'block_for' => null, 'after_commit' => false, ], ],

And my database Queue section is etup like this:

redis' => [

    'client' => 'phpredis',
    'options' => [
        'cluster' => 'redis',
        'prefix' => '{mmr}_',
        'persistent' => false,
    ],
    
    'default' => [
        'host' => 'tls://dsfajfhsdfjkasdfh.serverless.use1.cache.amazonaws.com',
        'username' => null,
        'password' => null,
        'port' => '6379',
        'database' => '0',
        'options' => [
            'prefix' => '{mmr}_',
        ],
    ],

record in the porstgresql database in job_batches get created, i can see on redis where is also gets created.

but when i run php artisan queue:monitor redis-dev

what is how is:

Queue name ......................................................................................................................... Size / Status [default_redis] redis-dev ................................................................................................................. [0] OK Pending jobs ................................................................................................................................... 0 Delayed jobs ................................................................................................................................... 0 Reserved jobs .................................................................................................................................. 0

and the job never starts even though i can see it in redis. Also i have horizon running but no workers for this queue because i manually run the worker for this queue that is how i can see it in pending jobs.

Glukinho's avatar

@Jboomer

->onQueue('{redis-dev}' ->dispatch();

Maybe a typo with { }? Shouldn't be this:

->onQueue('redis-dev')->dispatch();
Glukinho's avatar

@Jboomer

Why you have 'connection' => 'default' while php artisan queue:monitor gives you other connection name: [default_redis]? There may be confusion here.

What else do you have in configs regarding queues/connection names? Is there anything in .env file?

Glukinho's avatar

@Jboomer I mean, can this typo cause your problem? Or it's just here, when you shared a code?

Jboomer's avatar

@Glukinho it was just here when I shared my code.queue name does not have the brackets. I had that in previously as someone had said it helped with AWS elasticache

Jboomer's avatar

The weird thing is if just change the queueu syste to database and use the jobs table in thdata base everything works. so it has to with redis i am sure of it.

Jboomer's avatar

I even just simplified everyting justused the default queue on redis to see if it woudl work.

1 like
Yusuke1998's avatar

I have the exact same problem. It processes fine with a database, but not with Redis.

Please or to participate in this conversation.