1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Contain fallout from overheating feed queries on user profile pages

Summary: Fixes T13349. If the user profile page feed query overheats, it currently takes the whole page with it. Contain the blast to a smaller radius.

Test Plan: {F6633322}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13349

Differential Revision: https://secure.phabricator.com/D20678
This commit is contained in:
epriestley 2019-07-23 16:01:32 -07:00
parent cd44925425
commit 6831ed94fa

View file

@ -252,15 +252,30 @@ final class PhabricatorPeopleProfileViewController
PhabricatorUser $user, PhabricatorUser $user,
$viewer) { $viewer) {
$query = new PhabricatorFeedQuery(); $query = id(new PhabricatorFeedQuery())
$query->withFilterPHIDs( ->setViewer($viewer)
array( ->withFilterPHIDs(array($user->getPHID()))
$user->getPHID(), ->setLimit(100)
)); ->setReturnPartialResultsOnOverheat(true);
$query->setLimit(100);
$query->setViewer($viewer);
$stories = $query->execute(); $stories = $query->execute();
$overheated_view = null;
$is_overheated = $query->getIsOverheated();
if ($is_overheated) {
$overheated_message =
PhabricatorApplicationSearchController::newOverheatedError(
(bool)$stories);
$overheated_view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
->setTitle(pht('Query Overheated'))
->setErrors(
array(
$overheated_message,
));
}
$builder = new PhabricatorFeedBuilder($stories); $builder = new PhabricatorFeedBuilder($stories);
$builder->setUser($viewer); $builder->setUser($viewer);
$builder->setShowHovercards(true); $builder->setShowHovercards(true);
@ -268,8 +283,10 @@ final class PhabricatorPeopleProfileViewController
'requires but just a single step.')); 'requires but just a single step.'));
$view = $builder->buildView(); $view = $builder->buildView();
return $view->render(); return array(
$overheated_view,
$view->render(),
);
} }
} }