Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/255061

Change subject: EventPresentationModel: Cache the result of getBundledEvents()
......................................................................

EventPresentationModel: Cache the result of getBundledEvents()

Change-Id: I83ce3b7754055dd494fcde41f043144294da2f3f
---
M includes/formatters/EventPresentationModel.php
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/61/255061/1

diff --git a/includes/formatters/EventPresentationModel.php 
b/includes/formatters/EventPresentationModel.php
index a7a4110..7cb523e 100644
--- a/includes/formatters/EventPresentationModel.php
+++ b/includes/formatters/EventPresentationModel.php
@@ -88,17 +88,20 @@
                if ( !$this->event->getBundleHash() ) {
                        return array();
                }
+               if ( isset( $this->bundledEvents ) ) {
+                       return $this->bundledEvents;
+               }
 
                // FIXME: We really shouldn't be making db queries like this
                // in the presentation model
                $eventMapper = new EchoEventMapper();
-               $events = $eventMapper->fetchByUserBundleHash(
+               $this->bundledEvents = $eventMapper->fetchByUserBundleHash(
                        $this->user,
                        $this->event->getBundleHash()
                        // default params: web, DESC, limit=250
                );
 
-               return $events;
+               return $this->bundledEvents;
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/255061
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83ce3b7754055dd494fcde41f043144294da2f3f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Catrope <roan.katt...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to