Update realtime to use timer to avoid memory leaks on busy tick
This commit is contained in:
parent
92ad67b813
commit
ef0ac7768d
1 changed files with 11 additions and 5 deletions
|
@ -354,9 +354,12 @@ function clearSocketQueue(queue, socket) {
|
|||
}
|
||||
|
||||
function connectNextSocket() {
|
||||
setTimeout(function () {
|
||||
isConnectionBusy = false;
|
||||
if (connectionSocketQueue.length > 0)
|
||||
if (connectionSocketQueue.length > 0) {
|
||||
startConnection(connectionSocketQueue[0]);
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function interruptConnection(socket, note, user) {
|
||||
|
@ -693,8 +696,11 @@ function operationCallback(socket, operation) {
|
|||
}
|
||||
note.tempUsers[userId] = Date.now();
|
||||
}
|
||||
// save authorship
|
||||
// save authorship - use timer here because it's an O(n) complexity algorithm
|
||||
setImmediate(function () {
|
||||
note.authorship = models.Note.updateAuthorshipByOperation(operation, userId, note.authorship);
|
||||
});
|
||||
}
|
||||
|
||||
function updateHistory(userId, note, time) {
|
||||
var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id);
|
||||
|
|
Loading…
Reference in a new issue