Laravel queues not working

后端 未结 9 1010
梦谈多话
梦谈多话 2020-12-31 01:02

I am using laravel queues for commenting on the facebook post. When ever i recieve data from facebook webhook, based on the recieved details i am commenting on the post. To

9条回答
  •  醉梦人生
    2020-12-31 01:32

    I am seeing that you already have Queue table.

    Try running php artisan queue:listen --tries=3 or php artisan queue:work etc.

    Queue work is for executing only one Job per command. So if there are 20 jobs in the table you might have to run queue work 20 times. That's why you can run queue:listen command. But it eats up a lot of CPU.

    In the server, you might want to run your queue listen with max 3 tries in the background. SSH to your server in the Terminal / Command Prompt. Then CD to your project directory where the artisan file lives. Run this command:

    nohup php artisan queue:listen --tries=3 > /dev/null 2>&1 &

    In this case jobs will automatically be processed in the background. You just have to dispatch the job. And I would recommend using failed-jobs table. If you are using background queue listner.

    Hope this helps.

提交回复
热议问题