mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Improve handle batching behavior for commit list view
Summary: Ref T10978. Handle loads can be batched a bit more efficiently by doing them upfront. Test Plan: Queries dropped a bit locally, but I mostly have the same autors/auditors. I'm seeing 286 queries on my account in production, so I'll check what happens with that. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10978 Differential Revision: https://secure.phabricator.com/D17225
This commit is contained in:
parent
45c3aaeb26
commit
b8e04fe041
1 changed files with 25 additions and 12 deletions
|
@ -83,7 +83,21 @@ final class PhabricatorAuditListView extends AphrontView {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
$rowc = array();
|
$rowc = array();
|
||||||
|
|
||||||
$handles = $viewer->loadHandles(mpull($this->commits, 'getPHID'));
|
$phids = array();
|
||||||
|
foreach ($this->getCommits() as $commit) {
|
||||||
|
$phids[] = $commit->getPHID();
|
||||||
|
|
||||||
|
foreach ($commit->getAudits() as $audit) {
|
||||||
|
$phids[] = $audit->getAuditorPHID();
|
||||||
|
}
|
||||||
|
|
||||||
|
$author_phid = $commit->getAuthorPHID();
|
||||||
|
if ($author_phid) {
|
||||||
|
$phids[] = $author_phid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$handles = $viewer->loadHandles($phids);
|
||||||
|
|
||||||
$show_drafts = $this->getShowDrafts();
|
$show_drafts = $this->getShowDrafts();
|
||||||
|
|
||||||
|
@ -106,14 +120,6 @@ final class PhabricatorAuditListView extends AphrontView {
|
||||||
$commit_desc = $this->getCommitDescription($commit_phid);
|
$commit_desc = $this->getCommitDescription($commit_phid);
|
||||||
$committed = phabricator_datetime($commit->getEpoch(), $viewer);
|
$committed = phabricator_datetime($commit->getEpoch(), $viewer);
|
||||||
|
|
||||||
$audits = mpull($commit->getAudits(), null, 'getAuditorPHID');
|
|
||||||
$auditors = array();
|
|
||||||
foreach ($audits as $audit) {
|
|
||||||
$auditor_phid = $audit->getAuditorPHID();
|
|
||||||
$auditors[$auditor_phid] = $viewer->renderHandle($auditor_phid);
|
|
||||||
}
|
|
||||||
$auditors = phutil_implode_html(', ', $auditors);
|
|
||||||
|
|
||||||
$status = $commit->getAuditStatus();
|
$status = $commit->getAuditStatus();
|
||||||
|
|
||||||
$status_text =
|
$status_text =
|
||||||
|
@ -125,7 +131,7 @@ final class PhabricatorAuditListView extends AphrontView {
|
||||||
|
|
||||||
$author_phid = $commit->getAuthorPHID();
|
$author_phid = $commit->getAuthorPHID();
|
||||||
if ($author_phid) {
|
if ($author_phid) {
|
||||||
$author_name = $viewer->renderHandle($author_phid);
|
$author_name = $handles[$author_phid]->renderLink();
|
||||||
} else {
|
} else {
|
||||||
$author_name = $commit->getCommitData()->getAuthorName();
|
$author_name = $commit->getCommitData()->getAuthorName();
|
||||||
}
|
}
|
||||||
|
@ -145,8 +151,15 @@ final class PhabricatorAuditListView extends AphrontView {
|
||||||
->addAttribute(pht('Author: %s', $author_name))
|
->addAttribute(pht('Author: %s', $author_name))
|
||||||
->addIcon('none', $committed);
|
->addIcon('none', $committed);
|
||||||
|
|
||||||
if (!empty($auditors)) {
|
$audits = $commit->getAudits();
|
||||||
$item->addByLine(pht('Auditors: %s', $auditors));
|
$auditor_phids = mpull($audits, 'getAuditorPHID');
|
||||||
|
if ($auditor_phids) {
|
||||||
|
$item->addByLine(
|
||||||
|
array(
|
||||||
|
pht('Auditors:'),
|
||||||
|
' ',
|
||||||
|
$handles->newSublist($auditor_phids)->renderList(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($status_color) {
|
if ($status_color) {
|
||||||
|
|
Loading…
Reference in a new issue