1

I'm using Laravel 10 and PHP 8.1. I have a website monitoring platform which customers can add their websites and they're checked at an interval to see if the sites are up or down. My cron runs every minute.

My Job, UptimeChecker seems to be firing a lot of Illuminate\Queue\MaxAttemptsExceededException exceptions, and I'm wondering what I could be missing to significantly reduce, or get rid of them entirely.

I'm using supervisor, and have 32 workers configured, I'm specifying --tries=2 on my php artisan queue:work command and have set the following in my UptimeChecker job:

/**
 * The number of seconds the job can run before timing out.
 *
 * @var int
 */
public $timeout = 60;

My database connection for the queue is configured like this:

'database' => [
    'driver' => 'database',
    'table' => 'jobs',
    'queue' => 'default',
    'retry_after' => 180,
    'after_commit' => false,
],

Since retry_after is 180, and my timeout is 60, I'm not sure why I'm getting this error?

Illuminate\Queue\MaxAttemptsExceededException: App\Jobs\UptimeChecker has been attempted too many times or run too long. The job may have previously timed out. in /var/www/domain-monitor-api/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:780

1
  • MaxAttempsExceed is just an indication that your jobs is failing after hitting the maximum retry limit (Imagine if it throws an exception immediately) . It is not correlated to timeout or retry_after which is settings to control when the job will retry often from a crashed state or long running state Commented Mar 12, 2023 at 23:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.