Gor Azizyan
Gor Azizyan

Reputation: 13

Laravel Job fail issue

I need queue job to re-run if it failed. I set $tries = 3 but I need to know if in job I catch exception is this will be considered as filed job and will be re-run?

Upvotes: 0

Views: 233

Answers (1)

PtrTon
PtrTon

Reputation: 3845

The way a Laravel job knows if a jobs has failed is one of the following two:

  1. A job throws an exception which is NOT caught, resulting in the command failing with a big red text in the cli. (e.g. throw new \RuntimeException('something went wrong');
  2. A job returns an error statuscode (e.g. return -2;)

I posted a more elaborate answer here

Upvotes: 1

Related Questions