Skip to content

Commit

Permalink
[5.x] Fix #1419 (#1424)
Browse files Browse the repository at this point in the history
* show: check for $batch

* retry: check for $batch
  • Loading branch information
tmayrand authored Apr 25, 2024
1 parent bf3c4a8 commit 0f08459
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/Http/Controllers/BatchesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ public function show($id)
{
$batch = $this->batches->find($id);

$failedJobs = app(JobRepository::class)
->getJobs($batch->failedJobIds);
if ($batch) {
$failedJobs = app(JobRepository::class)
->getJobs($batch->failedJobIds);
}

return [
'batch' => $batch,
'failedJobs' => $failedJobs,
'failedJobs' => $failedJobs ?? null,
];
}

Expand All @@ -78,14 +80,16 @@ public function retry($id)
{
$batch = $this->batches->find($id);

app(JobRepository::class)
->getJobs($batch->failedJobIds)
->reject(function ($job) {
$payload = json_decode($job->payload);
if ($batch) {
app(JobRepository::class)
->getJobs($batch->failedJobIds)
->reject(function ($job) {
$payload = json_decode($job->payload);

return isset($payload->retry_of);
})->each(function ($job) {
dispatch(new RetryFailedJob($job->id));
});
return isset($payload->retry_of);
})->each(function ($job) {
dispatch(new RetryFailedJob($job->id));
});
}
}
}

0 comments on commit 0f08459

Please sign in to comment.