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

Fixed Lack of Memory when failing a job with wrong variable passed on the method fail() #45291

Merged
merged 5 commits into from Dec 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Illuminate/Queue/InteractsWithQueue.php
Expand Up @@ -3,6 +3,8 @@
namespace Illuminate\Queue;

use Illuminate\Contracts\Queue\Job as JobContract;
use InvalidArgumentException;
use Throwable;

trait InteractsWithQueue
{
Expand Down Expand Up @@ -43,8 +45,12 @@ public function delete()
*/
public function fail($exception = null)
{
if ($this->job) {
$this->job->fail($exception);
if ($exception instanceof Throwable || is_null($exception)) {
if ($this->job) {
return $this->job->fail($exception);
}
} else {
throw new InvalidArgumentException('The fail method requires an instance of Throwable.');
}
}

Expand Down