Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can laravel5.1 queue not retry? #11875

Closed
lzp819739483 opened this issue Jan 14, 2016 · 3 comments
Closed

Can laravel5.1 queue not retry? #11875

lzp819739483 opened this issue Jan 14, 2016 · 3 comments

Comments

@lzp819739483
Copy link

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

@GrahamCampbell
Copy link
Member

Yes.

@lzp819739483
Copy link
Author

how to do...

@jinchan-ck
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants