Skip to content

Commit a7bc852

Browse files
committed
notify observer
1 parent 51a0eba commit a7bc852

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Illuminate/Queue/Jobs/Job.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ public function fail($e = null)
223223
$event = new JobFailed($this->connectionName, $this, $e ?: new ManuallyFailedException);
224224
if ($this->observer) {
225225
$event->attach($this->observer);
226+
$event->notify();
226227
}
227228

228229
$this->resolve(Dispatcher::class)->dispatch($event);

src/Illuminate/Queue/Worker.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ protected function handleJobException($connectionName, $job, WorkerOptions $opti
499499
$event = new JobReleasedAfterException($connectionName, $job);
500500
if ($this->observer) {
501501
$event->attach($this->observer);
502+
$event->notify();
502503
}
503504

504505
$this->events->dispatch($event);
@@ -671,12 +672,13 @@ protected function raiseAfterJobPopEvent($connectionName, $job)
671672
*/
672673
protected function raiseBeforeJobEvent($connectionName, $job)
673674
{
674-
$jobProcessing = new JobProcessing($connectionName, $job);
675+
$event = new JobProcessing($connectionName, $job);
675676
if ($this->observer) {
676-
$jobProcessing->attach($this->observer);
677+
$event->attach($this->observer);
678+
$event->notify();
677679
}
678680

679-
$this->events->dispatch($jobProcessing);
681+
$this->events->dispatch($event);
680682
}
681683

682684
/**
@@ -691,6 +693,7 @@ protected function raiseAfterJobEvent($connectionName, $job)
691693
$event = new JobProcessed($connectionName, $job);
692694
if ($this->observer) {
693695
$event->attach($this->observer);
696+
$event->notify();
694697
}
695698

696699
$this->events->dispatch($event);

0 commit comments

Comments
 (0)