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

ThunderBirdsX3's avatar

Horizon always clear job after a while

I have deploy horizon to my production server and job always disappear after 10 seconds.

That make it cannot watch any job history in horizon

So, I have staging server that use same config (I use docker-compose for up server). But in staging server horizon work perfectly.

How to fix it?

horizon.php

'defaults' => [
        'supervisor-normal' => [
            'connection' => 'redis',
            'queue' => ['default'],
            'balance' => 'auto',
            'maxProcesses' => 1,
            'maxTime' => 0,
            'maxJobs' => 0,
            'memory' => 128,
            'tries' => 1,
            'timeout' => 60,
            'nice' => 0,
        ],

        'supervisor-impact' => [
            'connection' => 'redis',
            'queue' => ['high'],
            'balance' => 'auto',
            'maxProcesses' => 1,
            'maxTime' => 0,
            'maxJobs' => 0,
            'memory' => 256,
            'tries' => 1,
            'timeout' => 60,
            'nice' => 0,
        ],
    ],

    'environments' => [
        'production' => [
            'supervisor-normal' => [
                'maxProcesses' => 5,
                'balanceMaxShift' => 1,
                'balanceCooldown' => 3,
            ],

            'supervisor-impact' => [
                'maxProcesses' => 10,
                'balanceMaxShift' => 1,
                'balanceCooldown' => 3,
            ],
        ],

        'local' => [
            'supervisor-normal' => [
                'maxProcesses' => 3,
            ],

            'supervisor-impact' => [
                'maxProcesses' => 3,
            ],
        ],
    ],

supervisord.conf

[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid

[program:horizon]
command=/usr/bin/php /var/www/html/artisan horizon
autostart=true
autorestart=true
user=sail
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stopwaitsecs=3600

PS. in staging server APP_ENV=production

0 likes
1 reply
ThunderBirdsX3's avatar
ThunderBirdsX3
OP
Best Answer
Level 2

I found the troubleshooting.

the problem come from redis that have and error (About replicate or some thing) that make it restart and flush all data.

Please or to participate in this conversation.