Try to fix memory leaks by clear OT server before disconnect note
This commit is contained in:
parent
138aa876f4
commit
b734eb9c85
1 changed files with 3 additions and 0 deletions
|
@ -543,6 +543,9 @@ function disconnect(socket) {
|
||||||
if (note.server.isDirty) {
|
if (note.server.isDirty) {
|
||||||
updateNote(note, function (err, _note) {
|
updateNote(note, function (err, _note) {
|
||||||
if (err) return logger.error('disconnect note failed: ' + err);
|
if (err) return logger.error('disconnect note failed: ' + err);
|
||||||
|
// clear server before delete to avoid memory leaks
|
||||||
|
note.server.document = "";
|
||||||
|
note.server.operations = [];
|
||||||
delete note.server;
|
delete note.server;
|
||||||
delete notes[noteId];
|
delete notes[noteId];
|
||||||
if (config.debug) {
|
if (config.debug) {
|
||||||
|
|
Loading…
Reference in a new issue