Skip to content

Commit

Permalink
fix(perf): disable history on home page
Browse files Browse the repository at this point in the history
temporary workaround to reduce stress on mongodb, until we find a solution to solve #681 and #682.
root cause may be caused/related to #630 and/or #634.
  • Loading branch information
adrienjoly committed Sep 2, 2023
1 parent 9c0c9a3 commit 52536d3
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions app/controllers/LibFriends.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,22 @@ function fetchRecentActivity(uidList, loggedUid, cb) {
}

function prepareSidebar(uidList, options, cb) {
if (
feedTemplate.shouldRenderWholeProfilePage(options) &&
options.format != 'json'
) {
const loggedUser = uidList[uidList.length - 1];
console.time(`prepareSidebar_fetchRecentActivity_${loggedUser}`);
fetchRecentActivity(uidList, options.loggedUser.id, function (activities) {
console.timeEnd(`prepareSidebar_fetchRecentActivity_${loggedUser}`);
if (activities && activities.length)
options.recentActivity = { items: activities };
//console.time("fetchLast");
cb();
});
} else cb();
cb(); // fetchRecentActivity() cause performance problems => we disable it for now.

// if (
// feedTemplate.shouldRenderWholeProfilePage(options) &&
// options.format != 'json'
// ) {
// const loggedUser = uidList[uidList.length - 1];
// console.time(`prepareSidebar_fetchRecentActivity_${loggedUser}`);
// fetchRecentActivity(uidList, options.loggedUser.id, function (activities) {
// console.timeEnd(`prepareSidebar_fetchRecentActivity_${loggedUser}`);
// if (activities && activities.length)
// options.recentActivity = { items: activities };
// //console.time("fetchLast");
// cb();
// });
// } else cb();
}

function renderFriendsFeed(options, callback) {
Expand Down

0 comments on commit 52536d3

Please sign in to comment.