Repository: allura
Updated Branches:
refs/heads/master 392c4819d -> 49a481847
Provide a good index for last_post queries, so mongo won't ever pick the 'timestamp' index
which can be very slow
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/e6faf1b0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/e6faf1b0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/e6faf1b0
Branch: refs/heads/master
Commit: e6faf1b0efa08d8b88cc42c2d35339dcd4fa65d1
Parents: fd8533e
Author: Dave Brondsema <dave@brondsema.net>
Authored: Tue Jan 2 16:34:46 2018 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Tue Jan 2 16:34:58 2018 -0500
----------------------------------------------------------------------
ForgeDiscussion/forgediscussion/model/forum.py | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/e6faf1b0/ForgeDiscussion/forgediscussion/model/forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/model/forum.py b/ForgeDiscussion/forgediscussion/model/forum.py
index bab3edf..f0e90c0 100644
--- a/ForgeDiscussion/forgediscussion/model/forum.py
+++ b/ForgeDiscussion/forgediscussion/model/forum.py
@@ -215,6 +215,11 @@ class ForumPost(M.Post):
history_class = ForumPostHistory
indexes = [
'timestamp', # for the posts_24hr site_stats query
+ ( # for last_post queries on thread listing page
+ 'thread_id',
+ 'deleted',
+ ('timestamp', pymongo.DESCENDING),
+ ),
]
type_s = 'Post'
@@ -245,4 +250,5 @@ class ForumAttachment(M.DiscussionAttachment):
polymorphic_identity = 'ForumAttachment'
attachment_type = FieldProperty(str, if_missing='ForumAttachment')
+
Mapper.compile_all()
|