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

cverster's avatar

Horizon on Forge running old code

Hi all 👋

I'm running horizon on my DO server managed by Forge, and I'm struggling to get horizon to honour new Job code deployed to the server. Here is my deploy script:

cd /home/forge/bertie.app
git pull origin $FORGE_SITE_BRANCH

$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader

( flock -w 10 9 || exit 1
    echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock

if [ -f artisan ]; then
    $FORGE_PHP artisan optimize
    $FORGE_PHP artisan migrate --force
fi

php artisan horizon:terminate
php artisan queue:restart

npm install
npm run build

I'm running Horizon as a daemon, and I've tried restarting that, and also tried restarting Supervisor, but none of it seems to be working. Additionally, when I update my production environment in my horizon config, it does not change behaviour on my production environment. E.g. I have the following in my config file:

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

But it still runs 10 processes and it also times out after 60 seconds. Does anyone know if I need to take additional steps?

0 likes
3 replies
Sinnbeck's avatar

You don't seem to redo your cache?

php artisan optimize
php artisan horizon:terminate

Also, don't run both queue and horizon. Only restart horizon . Stop the regular queue and remove the command

cverster's avatar

@Sinnbeck Thanks for this but it didn't help. What is even more strange is that I update my code with logs for debugging, then when I fire jobs for horizon sometimes it runs the new code and sometimes it does not. I even restarted my server but Horizon is still not running the new code...

Please or to participate in this conversation.