Throttle expiring messages data query and deletion
I believe this to be the reason behind some of the high resource usage on startup. If a lot of read receipts come in for disappearing messages, this method can be called many, many times very quickly. FREEBIE
This commit is contained in:
parent
b2690afa32
commit
96b00b3e2d
1 changed files with 4 additions and 3 deletions
|
@ -17,7 +17,7 @@
|
|||
// the expiration before the message is removed from the database.
|
||||
message.destroy();
|
||||
});
|
||||
expired.on('reset', checkExpiringMessages);
|
||||
expired.on('reset', throttledCheckExpiringMessages);
|
||||
|
||||
expired.fetchExpired();
|
||||
}
|
||||
|
@ -38,13 +38,14 @@
|
|||
});
|
||||
expiring.fetchNextExpiring();
|
||||
}
|
||||
var throttledCheckExpiringMessages = _.throttle(checkExpiringMessages, 1000);
|
||||
|
||||
Whisper.ExpiringMessagesListener = {
|
||||
init: function(events) {
|
||||
checkExpiringMessages();
|
||||
events.on('timetravel', checkExpiringMessages);
|
||||
events.on('timetravel', throttledCheckExpiringMessages);
|
||||
},
|
||||
update: checkExpiringMessages
|
||||
update: throttledCheckExpiringMessages
|
||||
};
|
||||
|
||||
var TimerOption = Backbone.Model.extend({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue