Skip to content

Commit

Permalink
Use old dispatch_now if available in older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbrouwers committed Jan 26, 2023
1 parent 5a3d544 commit ba0b9b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ChunkReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ public function read(WithChunkReading $import, Reader $reader, TemporaryFile $te

$jobs->each(function ($job) {
try {
$this->dispatchNow($job);
function_exists('dispatch_now')
? dispatch_now($job)
: $this->dispatchNow($job);
} catch (Throwable $e) {
if (method_exists($job, 'failed')) {
$job->failed($e);
Expand Down

0 comments on commit ba0b9b9

Please sign in to comment.