Skip to content
Snippets Groups Projects
Unverified Commit ff8074e4 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Fix high CPU load when sending messages on large rooms (regression)

parent 5ee30aaf
No related branches found
No related tags found
No related merge requests found
......@@ -106,7 +106,10 @@ Meteor.methods({
RocketChat.models.Rooms.cache.on('sync', (type, room/*, diff*/) => {
const records = RocketChat.models.Subscriptions.findByRoomId(room._id).fetch();
for (const record of records) {
RocketChat.Notifications.notifyUserInThisInstance(record.u._id, 'rooms-changed', type, roomMap({_room: room}, getFieldsForUserId(record.u._id)));
const user = RocketChat.models.Users.findOneById(record.u._id);
if (user && (user.statusConnection === 'online' || user.statusConnection === 'away')) {
RocketChat.Notifications.notifyUserInThisInstance(record.u._id, 'rooms-changed', type, roomMap({_room: room}, getFieldsForUserId(record.u._id)));
}
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment