mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Treat PHP7 "Throwable" exceptions like other unhandled "Exception" cases in the worker queue
Summary: See PHI1745. Under PHP7, errors raised as Throwable miss this "generic exception" logic and don't increment their failure count. Instead, treat any "Throwable" we don't recognize like any "Exception" we don't recognize. Test Plan: - Under PHP7, caused a worker task to raise a Throwable (e.g., call to undefined method, see D21270). - Ran `bin/worker execute --id ...`. - Before: worker failed, but did not increment failure count. - After: worker fails and increments failure count as it would for other types of unknown error. Differential Revision: https://secure.phabricator.com/D21271
This commit is contained in:
parent
43a8d8763d
commit
4257b26abc
2 changed files with 8 additions and 1 deletions
|
@ -134,6 +134,7 @@ final class PhabricatorWorkerActiveTask extends PhabricatorWorkerTask {
|
||||||
|
|
||||||
$did_succeed = false;
|
$did_succeed = false;
|
||||||
$worker = null;
|
$worker = null;
|
||||||
|
$caught = null;
|
||||||
try {
|
try {
|
||||||
$worker = $this->getWorkerInstance();
|
$worker = $this->getWorkerInstance();
|
||||||
$worker->setCurrentWorkerTask($this);
|
$worker->setCurrentWorkerTask($this);
|
||||||
|
@ -180,6 +181,12 @@ final class PhabricatorWorkerActiveTask extends PhabricatorWorkerTask {
|
||||||
|
|
||||||
$result = $this;
|
$result = $this;
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
|
$caught = $ex;
|
||||||
|
} catch (Throwable $ex) {
|
||||||
|
$caught = $ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($caught) {
|
||||||
$this->setExecutionException($ex);
|
$this->setExecutionException($ex);
|
||||||
$this->setFailureCount($this->getFailureCount() + 1);
|
$this->setFailureCount($this->getFailureCount() + 1);
|
||||||
$this->setFailureTime(time());
|
$this->setFailureTime(time());
|
||||||
|
|
|
@ -34,7 +34,7 @@ abstract class PhabricatorWorkerTask extends PhabricatorWorkerDAO {
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function setExecutionException(Exception $execution_exception) {
|
final public function setExecutionException($execution_exception) {
|
||||||
$this->executionException = $execution_exception;
|
$this->executionException = $execution_exception;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue