dougua9328 2018-02-26 10:29
浏览 94

Laravel没有承认长时间工作的工作

I've a problem with running long time queue workers, I'm currently using Laravel 5.0. I used to queue the jobs on database and have no problem with that, but I needed to move this from DB so I went to rabbitmq, so I'm integrating this package: https://github.com/vyuldashev/laravel-queue-rabbitmq/tree/v5.0

Everything is doing well with short time jobs, ones taking less than 3 or 4 mints, but I'm trying to run a queue listener for jobs taking more than 10 mints, the thing is they don't get acknowledged and they remain in the unacked, and after 16.6 mints exactly - default ttl-; they moves to the next job and still not acked. And I'm getting broken pipe or connection sometimes if the process took too long.

I believe the problem is with the worker itself, not the package I'm using, and here're two examples for the queue listener I'm trying to apply, could you advice how to use them in a better way or what options I may use with them:

  • php artisan queue:listen rabbitmq --queue=QUEUENAME --timeout=0 --tries=2
  • php artisan queue:work rabbitmq --queue=QUEUENAME --daemon --tries=2
  • 写回答

1条回答 默认 最新

  • dqq46733 2018-10-17 15:40
    关注

    You can set the $timeout per job like so:

    namespace App\Jobs;
    class LongProcessJob implements ShouldQueue
    {
      /**
       * The number of seconds the job can run before timing out.
       * @var int
       */
      public $timeout = 120;
    }
    

    see Laravel Queues for more details.

    评论

报告相同问题?

悬赏问题

  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据