nekooee liked a comment+100 XP
5mos ago
nekooee wrote a reply+100 XP
5mos ago
My exact problem was the same. I had been struggling with AI for 48 hours, and it kept giving me useless answers while I tried all sorts of things, but nothing worked. Now I realized I had forgotten to take the BROADCAST_DRIVER value from the log and set it to “reverb.” Such a simple and funny mistake ended up delaying the whole project. Thanks for the reminder and for solving the issue.
nekooee started a new conversation+100 XP
5mos ago
I’m facing a strange issue with Laravel Horizon (v5.37) using Redis queues. Short delays (a few seconds or minutes) work perfectly, but any job delayed for the next day (e.g. 24h later) never gets executed automatically — unless I manually re-dispatch it or pause/start my system again.
Here’s my configuration:
config/horizon.php
'name' => env('HORIZON_NAME'),
'domain' => env('HORIZON_DOMAIN'),
'path' => env('HORIZON_PATH', 'horizon'),
'use' => 'default',
'prefix' => env(
'HORIZON_PREFIX',
Str::slug(env('APP_NAME', 'laravel'), '_').'_horizon:'
),
'middleware' => ['web', 'admin'],
'waits' => [
'redis:default' => 60,
'redis:sms' => 60,
'redis:update-price' => 60,
],
'trim' => [
'recent' => 120,
'pending' => 1500, // 25 hours
'completed' => 120,
'recent_failed' => 10080,
'failed' => 10080,
'monitored' => 10080,
],
'metrics' => [
'trim_snapshots' => [
'job' => 48,
'queue' => 48,
],
],
'fast_termination' => false,
'memory_limit' => 256,
'defaults' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['default', 'sms', 'update-price'],
'balance' => 'auto',
'autoScalingStrategy' => 'time',
'minProcesses' => 1,
'maxProcesses' => 4,
'maxTime' => 0,
'maxJobs' => 0,
'memory' => 256,
'tries' => 3,
'timeout' => 1800,
'nice' => 0,
],
],
'environments' => [
'production' => [
'supervisor-1' => [
'maxProcesses' => 4,
'balanceMaxShift' => 1,
'balanceCooldown' => 3,
],
],
],
Redis prefixes:
// horizon.php
'prefix' => env(
'HORIZON_PREFIX',
Str::slug(env('APP_NAME', 'laravel'), '_').'_horizon:'
),
// database.php
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
Should these two prefixes be the same? Because they are different now.
The delayed job is stored correctly in Redis:
zrange project_database_queues:sms:delayed 0 -1 withscores
It contains:
"date": "2025-11-01 11:00:00.000000",
"timezone": "Asia/Tehran"
and the timestamp matches perfectly.
However, when the scheduled time comes, Horizon never processes it. Shorter delays (like 5 seconds or a few minutes) work fine, so this only happens with long delays (around 24h or more).
Has anyone faced this?
Could Horizon or the Redis queue trimming system (trim.pending) be discarding long-term delayed jobs before execution, or is there a known limitation on 24h+ delays? Add this paragraph at the end of your Laracasts post:
Today I increased the trim.pending value to 25 hours (1500 minutes) just in case, but I’m not sure if it will make any difference.
Previously, even with pending = 120, the job still existed in the Redis queue (it wasn’t trimmed or deleted) — it simply never executed when its scheduled time arrived.