Skip to content

Commit

Permalink
FIX: Correctly log errors during job initialisation (fixes #316)
Browse files Browse the repository at this point in the history
  • Loading branch information
kinglozzer committed May 31, 2022
1 parent 84fc3e2 commit c370b27
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Services/QueuedJobService.php
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,17 @@ public function runJob($jobId)
$this->extend('updateJobDescriptorAndJobOnCompletion', $jobDescriptor, $job);
}
} catch (\Throwable $e) {
// PHP 7 Error handling)
// If the job failed initialisation $job will be null, so attempt to instantiate it here
if ($job === null) {
try {
$impl = $jobDescriptor->Implementation;
/** @var QueuedJob $job */
$job = Injector::inst()->create($impl);
} catch (\Throwable $e) {
// No-op
}
}

$this->handleBrokenJobException($jobDescriptor, $job, $e);
$broken = true;
}
Expand Down

0 comments on commit c370b27

Please sign in to comment.