mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
Fix an issue where pastes could be reordered as a side effect of cache fills
Summary: Ref T7803. Pastes which needed a cache fill would incorrectly be dropped to the bottom of the list. Stop doing that. Test Plan: Loaded a list of pastes with some that needed cache fills, saw them appear in the correct order. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7803 Differential Revision: https://secure.phabricator.com/D12354
This commit is contained in:
parent
604d1409f1
commit
e6174ed45c
1 changed files with 2 additions and 8 deletions
|
@ -90,7 +90,7 @@ final class PhabricatorPasteQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->needContent) {
|
if ($this->needContent) {
|
||||||
$pastes = $this->loadContent($pastes);
|
$this->loadContent($pastes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $pastes;
|
return $pastes;
|
||||||
|
@ -203,21 +203,19 @@ final class PhabricatorPasteQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
$caches = $cache->getKeys($keys);
|
$caches = $cache->getKeys($keys);
|
||||||
$results = array();
|
|
||||||
|
|
||||||
$need_raw = array();
|
$need_raw = array();
|
||||||
foreach ($pastes as $key => $paste) {
|
foreach ($pastes as $key => $paste) {
|
||||||
$key = $this->getContentCacheKey($paste);
|
$key = $this->getContentCacheKey($paste);
|
||||||
if (isset($caches[$key])) {
|
if (isset($caches[$key])) {
|
||||||
$paste->attachContent(phutil_safe_html($caches[$key]));
|
$paste->attachContent(phutil_safe_html($caches[$key]));
|
||||||
$results[$paste->getID()] = $paste;
|
|
||||||
} else {
|
} else {
|
||||||
$need_raw[$key] = $paste;
|
$need_raw[$key] = $paste;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$need_raw) {
|
if (!$need_raw) {
|
||||||
return $results;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$write_data = array();
|
$write_data = array();
|
||||||
|
@ -226,14 +224,10 @@ final class PhabricatorPasteQuery
|
||||||
foreach ($need_raw as $key => $paste) {
|
foreach ($need_raw as $key => $paste) {
|
||||||
$content = $this->buildContent($paste);
|
$content = $this->buildContent($paste);
|
||||||
$paste->attachContent($content);
|
$paste->attachContent($content);
|
||||||
|
|
||||||
$write_data[$this->getContentCacheKey($paste)] = (string)$content;
|
$write_data[$this->getContentCacheKey($paste)] = (string)$content;
|
||||||
$results[$paste->getID()] = $paste;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->setKeys($write_data);
|
$cache->setKeys($write_data);
|
||||||
|
|
||||||
return $results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildContent(PhabricatorPaste $paste) {
|
private function buildContent(PhabricatorPaste $paste) {
|
||||||
|
|
Loading…
Reference in a new issue