0

There is such a job. Sometimes the job is not executed and the message "App\Jobs\VotesJob has been attempted too many times or run too long. The job may have previously timed out. at /home/votes.us/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:750)" appears in the log

class VotesJob implements ShouldQueue
{
    use Dispatchable, 
        InteractsWithQueue, 
        Queueable;

    public $service;


    public function __construct($service)
    {
        $this->service = $service;
    }

    public function handle()
    {
        try {

            $this->service->startVotes();

        } catch (\Throwable $exception) {

            Log::error($exception->getMessage()); // This does not write any messages to the log

            throw $exception;
        }
    }

    public function middleware()
    {
        return [new ThrottlesExceptionsWithRedis(2, 5)];
    }

    public function retryUntil()
    {
        return now()->addHours(1);
    }
}

How can I catch the cause of this error?

Stack:

"php": "^8.0",
"laravel/framework": "^8.75",
"laravel/horizon": "^5.10",
Sanya H
  • 213
  • 3
  • 7

0 Answers0