0

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?

mare96
  • 3,749
  • 1
  • 16
  • 28

1 Answers1

1

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

PtrTon
  • 3,705
  • 2
  • 14
  • 24