diff --git a/src/EventMap.php b/src/EventMap.php index 4ad26978..0a684b7c 100644 --- a/src/EventMap.php +++ b/src/EventMap.php @@ -33,7 +33,12 @@ trait EventMap Listeners\MarkJobsAsMigrated::class, ], + \Illuminate\Queue\Events\JobExceptionOccurred::class => [ + Listeners\ForgetJobTimer::class, + ], + \Illuminate\Queue\Events\JobFailed::class => [ + Listeners\ForgetJobTimer::class, Listeners\MarshalFailedEvent::class, ], diff --git a/src/Listeners/ForgetJobTimer.php b/src/Listeners/ForgetJobTimer.php new file mode 100644 index 00000000..278b4330 --- /dev/null +++ b/src/Listeners/ForgetJobTimer.php @@ -0,0 +1,37 @@ +watch = $watch; + } + + /** + * Handle the event. + * + * @param \Illuminate\Queue\Events\JobExceptionOccurred|\Illuminate\Queue\Events\JobFailed $event + * @return void + */ + public function handle($event) + { + $this->watch->forget($event->job->getJobId()); + } +}