Skip to content

Job run many times. #27832

@AsemAlalami

Description

@AsemAlalami
  • Laravel Version: 5.8.3
  • PHP Version: 7.2
  • Database Driver & Version: mysql
  • Horizon: 3.0.3 (redis)
  • Homestead

Description:

I notice that the jobs still running without finished.
For example:

  • If assign $tries more than one time the job will still running more times or
  • If assign $timeoutAt to specific time and $tries to one time, the job will still running more times until timeoutAt time exceeded.

Steps To Reproduce:

I think the problem in markJobAsFailedIfAlreadyExceedsMaxAttempts in Worker:

    if ($timeoutAt && Carbon::now()->getTimestamp() <= $timeoutAt) {
         return;
    }

    if (! $timeoutAt && ($maxTries === 0 || $job->attempts() <= $maxTries)) {
        return;
    }

The check separately on timeoutAt and maxTries .

if check it together we will avoid this problem.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions