mirror of https://github.com/status-im/codimd.git
Fix potential memory leaks on realtime client disconnect not clean up server properly
This commit is contained in:
parent
cb75424f8e
commit
b3ba512cea
|
@ -478,6 +478,7 @@ 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);
|
||||||
|
delete note.server;
|
||||||
delete notes[noteId];
|
delete notes[noteId];
|
||||||
if (config.debug) {
|
if (config.debug) {
|
||||||
//logger.info(notes);
|
//logger.info(notes);
|
||||||
|
@ -487,6 +488,7 @@ function disconnect(socket) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
delete note.server;
|
||||||
delete notes[noteId];
|
delete notes[noteId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue