Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/metamta/PhabricatorMetaMTAWorker.php b/src/applications/metamta/PhabricatorMetaMTAWorker.php
index af655f4e0f..dcc6a8dc5e 100644
--- a/src/applications/metamta/PhabricatorMetaMTAWorker.php
+++ b/src/applications/metamta/PhabricatorMetaMTAWorker.php
@@ -1,46 +1,53 @@
<?php
final class PhabricatorMetaMTAWorker
extends PhabricatorWorker {
public function getMaximumRetryCount() {
return 250;
}
public function getWaitBeforeRetry(PhabricatorWorkerTask $task) {
return ($task->getFailureCount() * 15);
}
protected function doWork() {
$message = $this->loadMessage();
- if (!$message) {
- throw new PhabricatorWorkerPermanentFailureException(
- pht('Unable to load message!'));
- }
if ($message->getStatus() != PhabricatorMailOutboundStatus::STATUS_QUEUE) {
return;
}
try {
$message->sendNow();
} catch (PhabricatorMetaMTAPermanentFailureException $ex) {
// If the mailer fails permanently, fail this task permanently.
throw new PhabricatorWorkerPermanentFailureException($ex->getMessage());
}
}
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) {
return phutil_tag(
'pre',
array(
),
'phabricator/ $ ./bin/mail show-outbound --id '.$this->getTaskData());
}
}
diff --git a/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php b/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php
index 57a69843a4..c2276843db 100644
--- a/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php
+++ b/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php
@@ -1,65 +1,69 @@
<?php
final class PhabricatorTaskmasterDaemon extends PhabricatorDaemon {
protected function run() {
do {
PhabricatorCaches::destroyRequestCache();
$tasks = id(new PhabricatorWorkerLeaseQuery())
->setLimit(1)
->execute();
if ($tasks) {
$this->willBeginWork();
foreach ($tasks as $task) {
$id = $task->getID();
$class = $task->getTaskClass();
$this->log(pht('Working on task %d (%s)...', $id, $class));
$task = $task->executeTask();
$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 {
$this->log(pht('Task %d failed!', $id));
throw new PhutilProxyException(
pht('Error while executing Task ID %d.', $id),
$ex);
}
} else {
$this->log(pht('Task %s complete! Moved to archive.', $id));
}
}
$sleep = 0;
} else {
if ($this->getIdleDuration() > 15) {
$hibernate_duration = phutil_units('3 minutes in seconds');
if ($this->shouldHibernate($hibernate_duration)) {
break;
}
}
// When there's no work, sleep for one second. The pool will
// autoscale down if we're continuously idle for an extended period
// of time.
$this->willBeginIdle();
$sleep = 1;
}
$this->sleep($sleep);
} while (!$this->shouldExit());
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Jul 28, 12:37 PM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
186818
Default Alt Text
(4 KB)

Event Timeline