mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-01 19:22:42 +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:
parent
d5163d0143
commit
3400f24c8b
2 changed files with 20 additions and 9 deletions
|
@ -13,10 +13,6 @@ final class PhabricatorMetaMTAWorker
|
||||||
|
|
||||||
protected function doWork() {
|
protected function doWork() {
|
||||||
$message = $this->loadMessage();
|
$message = $this->loadMessage();
|
||||||
if (!$message) {
|
|
||||||
throw new PhabricatorWorkerPermanentFailureException(
|
|
||||||
pht('Unable to load message!'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($message->getStatus() != PhabricatorMailOutboundStatus::STATUS_QUEUE) {
|
if ($message->getStatus() != PhabricatorMailOutboundStatus::STATUS_QUEUE) {
|
||||||
return;
|
return;
|
||||||
|
@ -32,7 +28,18 @@ final class PhabricatorMetaMTAWorker
|
||||||
|
|
||||||
private function loadMessage() {
|
private function loadMessage() {
|
||||||
$message_id = $this->getTaskData();
|
$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) {
|
public function renderForDisplay(PhabricatorUser $viewer) {
|
||||||
|
|
|
@ -23,11 +23,15 @@ final class PhabricatorTaskmasterDaemon extends PhabricatorDaemon {
|
||||||
$ex = $task->getExecutionException();
|
$ex = $task->getExecutionException();
|
||||||
if ($ex) {
|
if ($ex) {
|
||||||
if ($ex instanceof PhabricatorWorkerPermanentFailureException) {
|
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(
|
pht(
|
||||||
'Task %d was cancelled: %s',
|
'Task "%s" encountered a permanent failure and was '.
|
||||||
$id,
|
'cancelled.',
|
||||||
$ex->getMessage()));
|
$id),
|
||||||
|
$ex);
|
||||||
|
phlog($log_exception);
|
||||||
} else if ($ex instanceof PhabricatorWorkerYieldException) {
|
} else if ($ex instanceof PhabricatorWorkerYieldException) {
|
||||||
$this->log(pht('Task %s yielded.', $id));
|
$this->log(pht('Task %s yielded.', $id));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue