Skip to content

Commit

Permalink
rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed May 8, 2017
1 parent 972a2e1 commit 583b1b8
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/Illuminate/Queue/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ class Worker
*/
public $shouldQuit = false;

/**
* Indicates if the worker should stop.
*
* @var bool
*/
public $shouldStop = false;

/**
* Indicates if the worker is paused.
*
Expand Down Expand Up @@ -205,8 +198,6 @@ protected function stopIfNecessary(WorkerOptions $options, $lastRestart)
$this->stop(12);
} elseif ($this->queueShouldRestart($lastRestart)) {
$this->stop();
} elseif ($this->shouldStop) {
$this->stop(1);
}
}

Expand Down Expand Up @@ -252,7 +243,7 @@ protected function getNextJob($connection, $queue)
} catch (Exception $e) {
$this->exceptions->report($e);

$this->handleException($e);
$this->stopWorkerIfLostConnection($e);
} catch (Throwable $e) {
$this->exceptions->report(new FatalThrowableError($e));
}
Expand All @@ -273,22 +264,22 @@ protected function runJob($job, $connectionName, WorkerOptions $options)
} catch (Exception $e) {
$this->exceptions->report($e);

$this->handleException($e);
$this->stopWorkerIfLostConnection($e);
} catch (Throwable $e) {
$this->exceptions->report(new FatalThrowableError($e));
}
}

/**
* Handle a serious job exception.
* Stop the worker if we have lost connection to a database.
*
* @param \Exception $e
* @return void
*/
protected function handleException($e)
protected function stopWorkerIfLostConnection($e)
{
if ($this->causedByLostConnection($e)) {
$this->shouldStop = true;
$this->shouldQuit = true;
}
}

Expand Down

0 comments on commit 583b1b8

Please sign in to comment.