mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-02 10:51:01 +01:00
Provide needAllTransactions()
for ConpherenceThreadQuery
Summary: Conphrenece is pretty slow right now; one reason is that threads can not be loaded without also loading all of their transactions. I want to get rid of this requirement, so make it explicit and then make all existing queries require it. In particular, loading a page like `/conpherence/1/` means we load all the transactions four times: to check that the thread exists, to build the thread list (which also loads all transactions for all other visible threads), to build the thread itself, and load all the transactions to build the widget panels. Ref T2421. Test Plan: Viewed threads, lists, widgets; replied to threads. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2421 Differential Revision: https://secure.phabricator.com/D5509
This commit is contained in:
parent
068de86fd5
commit
0dfcb35377
6 changed files with 18 additions and 1 deletions
|
@ -46,6 +46,7 @@ abstract class ConpherenceController extends PhabricatorController {
|
|||
$all_conpherences = id(new ConpherenceThreadQuery())
|
||||
->setViewer($user)
|
||||
->withPHIDs($all_conpherence_phids)
|
||||
->needAllTransactions(true)
|
||||
->execute();
|
||||
$unread_conpherences = array_select_keys(
|
||||
$all_conpherences,
|
||||
|
|
|
@ -31,6 +31,7 @@ final class ConpherenceListController
|
|||
if ($conpherence_id) {
|
||||
$conpherence = id(new ConpherenceThreadQuery())
|
||||
->setViewer($user)
|
||||
->needAllTransactions(true)
|
||||
->withIDs(array($conpherence_id))
|
||||
->executeOne();
|
||||
if (!$conpherence) {
|
||||
|
|
|
@ -32,6 +32,7 @@ final class ConpherenceUpdateController
|
|||
->withIDs(array($conpherence_id))
|
||||
->needOrigPics(true)
|
||||
->needHeaderPics(true)
|
||||
->needAllTransactions(true)
|
||||
->executeOne();
|
||||
$supported_formats = PhabricatorFile::getTransformableImageFormats();
|
||||
|
||||
|
@ -258,6 +259,7 @@ final class ConpherenceUpdateController
|
|||
->setAfterID($latest_transaction_id)
|
||||
->needHeaderPics(true)
|
||||
->needWidgetData(true)
|
||||
->needAllTransactions(true)
|
||||
->withIDs(array($conpherence_id))
|
||||
->executeOne();
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ final class ConpherenceViewController extends
|
|||
->setViewer($user)
|
||||
->withIDs(array($conpherence_id))
|
||||
->needHeaderPics(true)
|
||||
->needAllTransactions(true)
|
||||
->executeOne();
|
||||
$this->setConpherence($conpherence);
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ final class ConpherenceWidgetController extends
|
|||
->setViewer($user)
|
||||
->withIDs(array($conpherence_id))
|
||||
->needWidgetData(true)
|
||||
->needAllTransactions(true)
|
||||
->executeOne();
|
||||
$this->setConpherence($conpherence);
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ final class ConpherenceThreadQuery
|
|||
private $needWidgetData;
|
||||
private $needHeaderPics;
|
||||
private $needOrigPics;
|
||||
private $needAllTransactions;
|
||||
|
||||
public function needOrigPics($need_orig_pics) {
|
||||
$this->needOrigPics = $need_orig_pics;
|
||||
|
@ -27,6 +28,11 @@ final class ConpherenceThreadQuery
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function needAllTransactions($need_all_transactions) {
|
||||
$this->needAllTransactions = $need_all_transactions;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withIDs(array $ids) {
|
||||
$this->ids = $ids;
|
||||
return $this;
|
||||
|
@ -54,8 +60,13 @@ final class ConpherenceThreadQuery
|
|||
if ($conpherences) {
|
||||
$conpherences = mpull($conpherences, null, 'getPHID');
|
||||
$this->loadParticipants($conpherences);
|
||||
|
||||
if ($this->needAllTransactions) {
|
||||
$this->loadTransactionsAndHandles($conpherences);
|
||||
}
|
||||
|
||||
$this->loadFilePHIDs($conpherences);
|
||||
|
||||
if ($this->needWidgetData) {
|
||||
$this->loadWidgetData($conpherences);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue