@@ -49,13 +49,6 @@ class Worker
49
49
*/
50
50
public $ shouldQuit = false ;
51
51
52
- /**
53
- * Indicates if the worker should stop.
54
- *
55
- * @var bool
56
- */
57
- public $ shouldStop = false ;
58
-
59
52
/**
60
53
* Indicates if the worker is paused.
61
54
*
@@ -205,8 +198,6 @@ protected function stopIfNecessary(WorkerOptions $options, $lastRestart)
205
198
$ this ->stop (12 );
206
199
} elseif ($ this ->queueShouldRestart ($ lastRestart )) {
207
200
$ this ->stop ();
208
- } elseif ($ this ->shouldStop ) {
209
- $ this ->stop (1 );
210
201
}
211
202
}
212
203
@@ -252,7 +243,7 @@ protected function getNextJob($connection, $queue)
252
243
} catch (Exception $ e ) {
253
244
$ this ->exceptions ->report ($ e );
254
245
255
- $ this ->handleException ($ e );
246
+ $ this ->stopWorkerIfLostConnection ($ e );
256
247
} catch (Throwable $ e ) {
257
248
$ this ->exceptions ->report (new FatalThrowableError ($ e ));
258
249
}
@@ -273,22 +264,22 @@ protected function runJob($job, $connectionName, WorkerOptions $options)
273
264
} catch (Exception $ e ) {
274
265
$ this ->exceptions ->report ($ e );
275
266
276
- $ this ->handleException ($ e );
267
+ $ this ->stopWorkerIfLostConnection ($ e );
277
268
} catch (Throwable $ e ) {
278
269
$ this ->exceptions ->report (new FatalThrowableError ($ e ));
279
270
}
280
271
}
281
272
282
273
/**
283
- * Handle a serious job exception .
274
+ * Stop the worker if we have lost connection to a database .
284
275
*
285
276
* @param \Exception $e
286
277
* @return void
287
278
*/
288
- protected function handleException ($ e )
279
+ protected function stopWorkerIfLostConnection ($ e )
289
280
{
290
281
if ($ this ->causedByLostConnection ($ e )) {
291
- $ this ->shouldStop = true ;
282
+ $ this ->shouldQuit = true ;
292
283
}
293
284
}
294
285
0 commit comments