简体   繁体   中英

Laravel fails to acknowledge jobs for long time processes

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM