1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 07:20:57 +01:00

Send permanent dameon failures to the log, even when not running in verbose mode

Summary:
Fixes T12803. An install is having difficulty diagnosing mail failures, and one component is that permanent task failures aren't reaching the log.

It's reasonable to send these to the log even when "phd.verbose" is off. See T12803 for a rough review of when we generate these failrues today.

Test Plan:
  - Faked some exceptions.
  - Got a result in the log (P2058) with `phd.verbose` turned off.

Reviewers: chad, amckinley

Reviewed By: chad

Maniphest Tasks: T12803

Differential Revision: https://secure.phabricator.com/D18106
This commit is contained in:
epriestley 2017-06-08 06:18:48 -07:00
parent d5163d0143
commit 3400f24c8b
2 changed files with 20 additions and 9 deletions

View file

@ -13,10 +13,6 @@ final class PhabricatorMetaMTAWorker
protected function doWork() {
$message = $this->loadMessage();
if (!$message) {
throw new PhabricatorWorkerPermanentFailureException(
pht('Unable to load message!'));
}
if ($message->getStatus() != PhabricatorMailOutboundStatus::STATUS_QUEUE) {
return;
@ -32,7 +28,18 @@ final class PhabricatorMetaMTAWorker
private function loadMessage() {
$message_id = $this->getTaskData();
return id(new PhabricatorMetaMTAMail())->load($message_id);
$message = id(new PhabricatorMetaMTAMail())
->load($message_id);
if (!$message) {
throw new PhabricatorWorkerPermanentFailureException(
pht(
'Unable to load mail message (with ID "%s") while preparing to '.
'deliver it.',
$message_id));
}
return $message;
}
public function renderForDisplay(PhabricatorUser $viewer) {

View file

@ -23,11 +23,15 @@ final class PhabricatorTaskmasterDaemon extends PhabricatorDaemon {
$ex = $task->getExecutionException();
if ($ex) {
if ($ex instanceof PhabricatorWorkerPermanentFailureException) {
$this->log(
// NOTE: Make sure these reach the daemon log, even when not
// running in "phd.verbose" mode. See T12803 for discussion.
$log_exception = new PhutilProxyException(
pht(
'Task %d was cancelled: %s',
$id,
$ex->getMessage()));
'Task "%s" encountered a permanent failure and was '.
'cancelled.',
$id),
$ex);
phlog($log_exception);
} else if ($ex instanceof PhabricatorWorkerYieldException) {
$this->log(pht('Task %s yielded.', $id));
} else {