1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 23:01:04 +01:00

When the feed query on project profile pages overheats, contain the damage

Summary:
Ref T13349. This is almost the same change as D20678, but for project profiles instead of user profiles.

The general reproduction case is "view a project where you can't see more than 50 of the 500 most recent feed stories".

Test Plan:
  - Forced all queries to overheat.
  - Viewed a project profile page.
  - Before: overheating fatal near top level.
  - After: damage contained to feed panel.

Maniphest Tasks: T13349

Differential Revision: https://secure.phabricator.com/D20704
This commit is contained in:
epriestley 2019-08-08 10:35:04 -07:00
parent 9bd74dfa6c
commit 0a3c26998f

View file

@ -78,14 +78,29 @@ final class PhabricatorProjectProfileController
$project,
PhabricatorProject::ITEM_PROFILE);
$stories = id(new PhabricatorFeedQuery())
$query = id(new PhabricatorFeedQuery())
->setViewer($viewer)
->withFilterPHIDs(
array(
$project->getPHID(),
))
->withFilterPHIDs(array($project->getPHID()))
->setLimit(50)
->execute();
->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,
));
}
$view_all = id(new PHUIButtonView())
->setTag('a')
@ -103,7 +118,11 @@ final class PhabricatorProjectProfileController
$feed = id(new PHUIObjectBoxView())
->setHeader($feed_header)
->addClass('project-view-feed')
->appendChild($feed);
->appendChild(
array(
$overheated_view,
$feed,
));
require_celerity_resource('project-view-css');