@@ -143,7 +143,7 @@ public function daemon($connectionName, $queue, WorkerOptions $options)
143
143
$ status = $ this ->pauseWorker ($ options , $ lastRestart );
144
144
145
145
if (! is_null ($ status )) {
146
- return $ this ->stop ($ status );
146
+ return $ this ->stop ($ status, $ options );
147
147
}
148
148
149
149
continue ;
@@ -191,7 +191,7 @@ public function daemon($connectionName, $queue, WorkerOptions $options)
191
191
);
192
192
193
193
if (! is_null ($ status )) {
194
- return $ this ->stop ($ status );
194
+ return $ this ->stop ($ status, $ options );
195
195
}
196
196
}
197
197
}
@@ -223,7 +223,7 @@ protected function registerTimeoutHandler($job, WorkerOptions $options)
223
223
);
224
224
}
225
225
226
- $ this ->kill (static ::EXIT_ERROR );
226
+ $ this ->kill (static ::EXIT_ERROR , $ options );
227
227
});
228
228
229
229
pcntl_alarm (
@@ -579,7 +579,7 @@ protected function markJobAsFailedIfItShouldFailOnTimeout($connectionName, $job,
579
579
*/
580
580
protected function failJob ($ job , Throwable $ e )
581
581
{
582
- return $ job ->fail ($ e );
582
+ $ job ->fail ($ e );
583
583
}
584
584
585
585
/**
@@ -676,21 +676,10 @@ protected function listenForSignals()
676
676
{
677
677
pcntl_async_signals (true );
678
678
679
- pcntl_signal (SIGQUIT , function () {
680
- $ this ->shouldQuit = true ;
681
- });
682
-
683
- pcntl_signal (SIGTERM , function () {
684
- $ this ->shouldQuit = true ;
685
- });
686
-
687
- pcntl_signal (SIGUSR2 , function () {
688
- $ this ->paused = true ;
689
- });
690
-
691
- pcntl_signal (SIGCONT , function () {
692
- $ this ->paused = false ;
693
- });
679
+ pcntl_signal (SIGQUIT , fn () => $ this ->shouldQuit = true );
680
+ pcntl_signal (SIGTERM , fn () => $ this ->shouldQuit = true );
681
+ pcntl_signal (SIGUSR2 , fn () => $ this ->paused = true );
682
+ pcntl_signal (SIGCONT , fn () => $ this ->paused = false );
694
683
}
695
684
696
685
/**
@@ -718,11 +707,12 @@ public function memoryExceeded($memoryLimit)
718
707
* Stop listening and bail out of the script.
719
708
*
720
709
* @param int $status
710
+ * @param WorkerOptions|null $options
721
711
* @return int
722
712
*/
723
- public function stop ($ status = 0 )
713
+ public function stop ($ status = 0 , $ options = null )
724
714
{
725
- $ this ->events ->dispatch (new WorkerStopping ($ status ));
715
+ $ this ->events ->dispatch (new WorkerStopping ($ status, $ options ));
726
716
727
717
return $ status ;
728
718
}
@@ -731,11 +721,12 @@ public function stop($status = 0)
731
721
* Kill the process.
732
722
*
733
723
* @param int $status
724
+ * @param \Illuminate\Queue\WorkerOptions|null $options
734
725
* @return never
735
726
*/
736
- public function kill ($ status = 0 )
727
+ public function kill ($ status = 0 , $ options = null )
737
728
{
738
- $ this ->events ->dispatch (new WorkerStopping ($ status ));
729
+ $ this ->events ->dispatch (new WorkerStopping ($ status, $ options ));
739
730
740
731
if (extension_loaded ('posix ' )) {
741
732
posix_kill (getmypid (), SIGKILL );
@@ -817,7 +808,7 @@ public static function popUsing($workerName, $callback)
817
808
/**
818
809
* Get the queue manager instance.
819
810
*
820
- * @return \Illuminate\Queue\QueueManager
811
+ * @return \Illuminate\Contracts\ Queue\Factory
821
812
*/
822
813
public function getManager ()
823
814
{
0 commit comments