From e6174ed45cbd69ce2c702ca07e9edf3161082ab7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 11 Apr 2015 18:38:48 -0700 Subject: [PATCH] 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 --- src/applications/paste/query/PhabricatorPasteQuery.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/applications/paste/query/PhabricatorPasteQuery.php b/src/applications/paste/query/PhabricatorPasteQuery.php index 75f1f81315..35c3820311 100644 --- a/src/applications/paste/query/PhabricatorPasteQuery.php +++ b/src/applications/paste/query/PhabricatorPasteQuery.php @@ -90,7 +90,7 @@ final class PhabricatorPasteQuery } if ($this->needContent) { - $pastes = $this->loadContent($pastes); + $this->loadContent($pastes); } return $pastes; @@ -203,21 +203,19 @@ final class PhabricatorPasteQuery } $caches = $cache->getKeys($keys); - $results = array(); $need_raw = array(); foreach ($pastes as $key => $paste) { $key = $this->getContentCacheKey($paste); if (isset($caches[$key])) { $paste->attachContent(phutil_safe_html($caches[$key])); - $results[$paste->getID()] = $paste; } else { $need_raw[$key] = $paste; } } if (!$need_raw) { - return $results; + return; } $write_data = array(); @@ -226,14 +224,10 @@ final class PhabricatorPasteQuery foreach ($need_raw as $key => $paste) { $content = $this->buildContent($paste); $paste->attachContent($content); - $write_data[$this->getContentCacheKey($paste)] = (string)$content; - $results[$paste->getID()] = $paste; } $cache->setKeys($write_data); - - return $results; } private function buildContent(PhabricatorPaste $paste) {