lundi 10 juin 2019

Larave 5.8 async queue issue using supervisor

I am using Laravel queues in my application, i have following configuration,

.env:

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=database
SESSION_DRIVER=file

config/queue.config

'default' => env('QUEUE_CONNECTION', 'sync'),


    'connections' => [

        'sync' => [
            'driver' => 'sync',
        ],

        'database' => [
            'driver' => 'database',
            'table' => 'jobs',
            'queue' => 'default',
            'retry_after' => 90,
        ],

i have setup supervisor and it has following configuration

/etc/supervisor/conf.d/laravel_queue.sh

[program:laravel_queue]
process_name=%(program_name)s_%(process_num)02d
command=php /usr/local/bin/run_queue.sh
startsecs = 0
autostart=true
autorestart=true
user=root
redirect_stderr=true
stderr_logfile=/var/log/laraqueue.err.log
stdout_logfile=/var/log/laraqueue.out.log

/usr/local/bin/run_queue.sh

php /var/www/myproject/artisan queue:work --tries=1

Problem:

when i set QUEUE_CONNECTION=sync it works fine but jobs are executed synchronously, i want them to execute asynchronously. So when i set QUEUE_CONNECTION=database my jobs are not executed at all and i can see them sitting in my jobs table.

I have also observed that when i run php artisan queue:work directly from my project's directory it works as expected, that is jobs are executed asynchronously.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire