laravellaravel-queuehorizon

supervisor and queue is not working in horizon


horizon is setup in local is working properly, local horizon dashboard show me the supervisor info and current workload But in production horizon dashboard the status is active and not show supervisor and current workload info. it is showing batches in pending status

This type of horizon dashboard is showing in production :- https://user-images.githubusercontent.com/5956778/58878223-09ac0280-86d3-11e9-8442-fe0a58059174.png

-add the supervisors -update the QUEUE_CONNECTION to redis -try the php artisan horizon:terminate


Solution

  • make sure to modify your horizon config in config/horizon.php,

    here is an example:

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

    this array is default environment for your supervisor which can be located in horizon.php

    and the following array environment in local and production:

         'environments' => [
            'production' => [
                'supervisor-1' => [
                    'queue' => ['default'],
                    'maxProcesses' => 10,
                    'balanceMaxShift' => 1,
                    'balanceCooldown' => 3,
                ], 
            ],
    
            'local' => [
                'supervisor-1' => [
                    'queue' => ['default'],
                    'maxProcesses' => 10,
                ],
            ],
        ],
    

    i think you need to modify the production part to fix your problem. but if this not works too, send your supervisor configuration file maybe problems is there.