From 6831ed94faf6993b022387e64f3cb605bf92bbc8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 23 Jul 2019 16:01:32 -0700 Subject: [PATCH] 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 --- ...PhabricatorPeopleProfileViewController.php | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php index b5c0e2b816..b929d980d5 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php @@ -252,15 +252,30 @@ final class PhabricatorPeopleProfileViewController PhabricatorUser $user, $viewer) { - $query = new PhabricatorFeedQuery(); - $query->withFilterPHIDs( - array( - $user->getPHID(), - )); - $query->setLimit(100); - $query->setViewer($viewer); + $query = id(new PhabricatorFeedQuery()) + ->setViewer($viewer) + ->withFilterPHIDs(array($user->getPHID())) + ->setLimit(100) + ->setReturnPartialResultsOnOverheat(true); + $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->setUser($viewer); $builder->setShowHovercards(true); @@ -268,8 +283,10 @@ final class PhabricatorPeopleProfileViewController 'requires but just a single step.')); $view = $builder->buildView(); - return $view->render(); - + return array( + $overheated_view, + $view->render(), + ); } }