Framework: Can laravel5.1 queue not retry?

Created on 14 Jan 2016  Â·  3Comments  Â·  Source: laravel/framework

I use laravel queue and while job failed it will retry, Can it not retry?

All 3 comments

Yes.

how to do...

how to make laravel queue not retry ?

    /**
     * Mark the given job as failed if it has exceeded the maximum allowed attempts.
     *
     * This will likely be because the job previously exceeded a timeout.
     *
     * @param  string  $connectionName
     * @param  \Illuminate\Contracts\Queue\Job  $job
     * @param  int  $maxTries
     * @return void
     */
    protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($connectionName, $job, $maxTries)
    {
        if ($maxTries === 0 || $job->attempts() <= $maxTries) {
            return;
        }

        $e = new MaxAttemptsExceededException(
            'A queued job has been attempted too many times. The job may have previously timed out.'
        );

        $this->failJob($connectionName, $job, $e);

        throw $e;
    }

if ($maxTries === 0 || $job->attempts() <= $maxTries) means neither 0 nor 1 for --tries param can do that.

Was this page helpful?
0 / 5 - 0 ratings