/**
  * @task pull
  */
 private function resolveUpdateFuture(PhabricatorRepository $repository, ExecFuture $future, $min_sleep)
 {
     $monogram = $repository->getMonogram();
     $this->log(pht('Resolving update for "%s".', $monogram));
     try {
         list($stdout, $stderr) = $future->resolvex();
     } catch (Exception $ex) {
         $proxy = new PhutilProxyException(pht('Error while updating the "%s" repository.', $repository->getMonogram()), $ex);
         phlog($proxy);
         return time() + $min_sleep;
     }
     if (strlen($stderr)) {
         $stderr_msg = pht('Unexpected output while updating repository "%s": %s', $monogram, $stderr);
         phlog($stderr_msg);
     }
     // For now, continue respecting this deprecated setting for raising the
     // minimum pull frequency.
     // TODO: Remove this some day once this code has been completely stable
     // for a while.
     $sleep_for = (int) $repository->getDetail('pull-frequency');
     $min_sleep = max($sleep_for, $min_sleep);
     $smart_wait = $repository->loadUpdateInterval($min_sleep);
     $this->log(pht('Based on activity in repository "%s", considering a wait of %s ' . 'seconds before update.', $repository->getMonogram(), new PhutilNumber($smart_wait)));
     return time() + $smart_wait;
 }
 private function buildRepositoryUpdateInterval(PhabricatorRepository $repository)
 {
     $smart_wait = $repository->loadUpdateInterval();
     $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Repository Updates');
     return array(phutil_format_relative_time_detailed($smart_wait), " · ", phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Learn More')));
 }
 /**
  * @task pull
  */
 private function resolveUpdateFuture(PhabricatorRepository $repository, ExecFuture $future, $min_sleep)
 {
     $monogram = $repository->getMonogram();
     $this->log(pht('Resolving update for "%s".', $monogram));
     try {
         list($stdout, $stderr) = $future->resolvex();
     } catch (Exception $ex) {
         $proxy = new PhutilProxyException(pht('Error while updating the "%s" repository.', $repository->getMonogram()), $ex);
         phlog($proxy);
         return time() + $min_sleep;
     }
     if (strlen($stderr)) {
         $stderr_msg = pht('Unexpected output while updating repository "%s": %s', $monogram, $stderr);
         phlog($stderr_msg);
     }
     $smart_wait = $repository->loadUpdateInterval($min_sleep);
     $this->log(pht('Based on activity in repository "%s", considering a wait of %s ' . 'seconds before update.', $repository->getMonogram(), new PhutilNumber($smart_wait)));
     return time() + $smart_wait;
 }