You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/02/18 22:51:19 UTC

git commit: [#7186] add artifact_feed index on project_id, -pubdate

Repository: incubator-allura
Updated Branches:
  refs/heads/db/7186 [created] 471266a2c


[#7186] add artifact_feed index on project_id, -pubdate


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/471266a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/471266a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/471266a2

Branch: refs/heads/db/7186
Commit: 471266a2c13ba8b3999f51266a3ad8650a44c181
Parents: ef2fcae
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Feb 18 21:51:04 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Feb 18 21:51:04 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/artifact.py | 3 +++
 Allura/allura/model/auth.py     | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/471266a2/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 19071c7..d54a08e 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -763,6 +763,9 @@ class Feed(MappedClass):
              ('pubdate', pymongo.DESCENDING)),
             # used in ext/user_profile/user_main.py for user feeds
             'author_link',
+            # used in project feed
+            (('project_id', pymongo.ASCENDING),
+             ('pubdate', pymongo.DESCENDING)),
         ]
 
     _id = FieldProperty(S.ObjectId)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/471266a2/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index f9e3a4c..d9dd276 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -729,7 +729,11 @@ class User(MappedClass, ActivityNode, ActivityObject):
 
     @classmethod
     def anonymous(cls):
-        return User.query.get(_id=None)
+        # ming caches .get(_id=...) queries for the duration of a ming session
+        # but we don't even want to do this query once per request, it'll be the same always and forever
+        if not hasattr(cls, '_anonymous_user'):
+            cls._anonymous_user = User.query.get(_id=None)
+        return cls._anonymous_user
 
     def is_anonymous(self):
         return self._id is None or self.username == ''