Path: blob/master/src/applications/metamta/PhabricatorMetaMTAWorker.php
12249 views
<?php12final class PhabricatorMetaMTAWorker3extends PhabricatorWorker {45public function getMaximumRetryCount() {6return 250;7}89public function getWaitBeforeRetry(PhabricatorWorkerTask $task) {10return ($task->getFailureCount() * 15);11}1213protected function doWork() {14$message = $this->loadMessage();1516if ($message->getStatus() != PhabricatorMailOutboundStatus::STATUS_QUEUE) {17return;18}1920try {21$message->sendNow();22} catch (PhabricatorMetaMTAPermanentFailureException $ex) {23// If the mailer fails permanently, fail this task permanently.24throw new PhabricatorWorkerPermanentFailureException($ex->getMessage());25}26}2728private function loadMessage() {29$message_id = $this->getTaskData();30$message = id(new PhabricatorMetaMTAMail())31->load($message_id);3233if (!$message) {34throw new PhabricatorWorkerPermanentFailureException(35pht(36'Unable to load mail message (with ID "%s") while preparing to '.37'deliver it.',38$message_id));39}4041return $message;42}4344public function renderForDisplay(PhabricatorUser $viewer) {45return phutil_tag(46'pre',47array(48),49'phabricator/ $ ./bin/mail show-outbound --id '.$this->getTaskData());50}5152}535455