late night optimizations

-isMemberOfSets returns true/false instead of 1/0
-when loading the posts of a topic only get the userdata for each user
once, before this commit if a topic had 10 posts from 2 different users
we were getting the user data for each user 5 times (drunk)
-getVoteStatusByPostIDs and getFavouritesByPostIDs no longer make
pids.length calls to the db, they use isMemberOfSets now
-getUserInfoForPost renamed to getUserInfoForPosts and doesnt make
uids.length calls to db, uses getMultipleUserFields instead
This commit is contained in:
barisusakli
2014-06-28 01:03:26 -04:00
parent d3fc71529a
commit c3a9767bf6
9 changed files with 137 additions and 86 deletions

View File

@@ -350,7 +350,7 @@
db.isMemberOfSets(groupSets, uid, function(err, isMembers) {
for(var i=isMembers.length - 1; i>=0; --i) {
if (parseInt(isMembers[i], 10) !== 1) {
if (!isMembers[i]) {
groupData.splice(i, 1);
}
}