8000 Fixes #19072 · iget-master/framework@ddf6d4a · GitHub
[go: up one dir, main page]

Skip to content

Commit ddf6d4a

Browse files
committed
1 parent db01aa3 commit ddf6d4a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Illuminate/Queue/Worker.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace Illuminate\Queue;
44

55
use Exception;
6+
use Illuminate\Database\DetectsLostConnections;
7+
use PDOException;
68
use Throwable;
79
use Illuminate\Contracts\Events\Dispatcher;
810
use Illuminate\Contracts\Debug\ExceptionHandler;
@@ -11,6 +13,8 @@
1113

1214
class Worker
1315
{
16+
use DetectsLostConnections;
17+
1418
/**
1519
* The queue manager instance.
1620
*
@@ -233,10 +237,14 @@ protected function getNextJob($connection, $queue)
233237
{
234238
try {
235239
foreach (explode(',', $queue) as $queue) {
236-
if (! is_null($job = $connection->pop($queue))) {
240+
if (!is_null($job = $connection->pop($queue))) {
237241
return $job;
238242
}
239243
}
244+
} catch (PDOException $e) {
245+
if ($this->causedByLostConnection($e)) {
246+
$this->stop(1);
247+
}
240248
} catch (Exception $e) {
241249
$this->exceptions->report($e);
242250
} catch (Throwable $e) {

0 commit comments

Comments
 (0)
0