Skip to content

Commit

Permalink
Merge pull request #628 from assistify/release/1.1.3-0.9.11
Browse files Browse the repository at this point in the history
Fix smarti resync performance impact
  • Loading branch information
ruKurz authored Aug 16, 2019
2 parents 1d74418 + ae7f039 commit d39bdd6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
7 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Assistify 0.9.11

This release fixes a severe bug 🐛 with respect to frontend performance:
In large rooms, new messages triggered the loading of many previous messages which in turn increased memory, made the scolling jump and led the UI non-responsive in the worst case to to a re-calculation of mention marks.

Now, messages are not re-synced implicitly to Smarti anymore, removing the trigger for the message reloading.

# Assistify 0.9.10

This Release bumps Rocket.Chat to 1.1.3
Expand Down
13 changes: 10 additions & 3 deletions app/assistify/ai/server/lib/SmartiAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,14 @@ export class SmartiAdapter {
Meteor.defer(() => SmartiAdapter._markMessageAsSynced(message._id));
notifyClientsSmartiDirty(message.rid, conversationId);
// autosync: If a room was not in sync, but the new message could be synced, try to sync the room again

/*
Remove autosync after a message is sent due to negative side effects:
In the course of marking a messages synced, an update on a message is performed.
This makes the UI load the updated message.
Depending on the message count resynced, this can have a severe impact on client performance
Meteor.defer(() => SmartiAdapter._tryResync(message.rid, false));
*/
} else {
// if the message could not be synced this time, re-synch the complete room next time
Meteor.defer(() => SmartiAdapter._markRoomAsUnsynced(message.rid));
Expand Down Expand Up @@ -412,8 +419,8 @@ export class SmartiAdapter {
try {
SystemLogger.debug('Sync messages for room: ', roomId);

const limit = parseInt(settings.get('Assistify_AI_Resync_Message_Limit')) || 1000;
const messageFindOptions = { sort: { ts: 1 }, limit };
const limit = parseInt(settings.get('Assistify_AI_Resync_Message_Limit')) || 10;
const messageFindOptions = { sort: { ts: -1 }, limit };

// only resync rooms containing outdated messages, if a delta sync is requested
if (!ignoreSyncFlag || ignoreSyncFlag !== true) {
Expand All @@ -424,7 +431,7 @@ export class SmartiAdapter {
return true;
}

SystemLogger.debug('Messages out of sync: ', unsync.length);
SystemLogger.debug('Messages out of sync: ', unsync);
}

// delete convervation from Smarti, if already exists
Expand Down
2 changes: 1 addition & 1 deletion app/utils/rocketchat.info
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.1.3-0.9.10"
"version": "1.1.3-0.9.11"
}

0 comments on commit d39bdd6

Please sign in to comment.