File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 3
3
namespace Illuminate \Queue ;
4
4
5
5
use Exception ;
6
+ use Illuminate \Database \DetectsLostConnections ;
7
+ use PDOException ;
6
8
use Throwable ;
7
9
use Illuminate \Contracts \Events \Dispatcher ;
8
10
use Illuminate \Contracts \Debug \ExceptionHandler ;
11
13
12
14
class Worker
13
15
{
16
+ use DetectsLostConnections;
17
+
14
18
/**
15
19
* The queue manager instance.
16
20
*
@@ -233,10 +237,14 @@ protected function getNextJob($connection, $queue)
233
237
{
234
238
try {
235
239
foreach (explode (', ' , $ queue ) as $ queue ) {
236
- if (! is_null ($ job = $ connection ->pop ($ queue ))) {
240
+ if (!is_null ($ job = $ connection ->pop ($ queue ))) {
237
241
return $ job ;
238
242
}
239
243
}
244
+ } catch (PDOException $ e ) {
245
+ if ($ this ->causedByLostConnection ($ e )) {
246
+ $ this ->stop (1 );
247
+ }
240
248
} catch (Exception $ e ) {
241
249
$ this ->exceptions ->report ($ e );
242
250
} catch (Throwable $ e ) {
You can’t perform that action at this time.
0 commit comments