mirror of https://github.com/status-im/codimd.git
Fix socket disconnect might interrupt loop issue
This commit is contained in:
parent
211d25253e
commit
1418b7a801
|
@ -97,7 +97,9 @@ var updater = setInterval(function () {
|
|||
for (var i = 0, l = note.socks.length; i < l; i++) {
|
||||
var sock = note.socks[i];
|
||||
if (typeof sock !== 'undefined' && sock) {
|
||||
sock.disconnect(true);
|
||||
setTimeout(function () {
|
||||
sock.disconnect(true);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
return callback(err, null);
|
||||
|
@ -787,7 +789,9 @@ function connection(socket) {
|
|||
sock.emit('info', {
|
||||
code: 403
|
||||
});
|
||||
return sock.disconnect(true);
|
||||
setTimeout(function () {
|
||||
sock.disconnect(true);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -818,7 +822,9 @@ function connection(socket) {
|
|||
var sock = note.socks[i];
|
||||
if (typeof sock !== 'undefined' && sock) {
|
||||
sock.emit('delete');
|
||||
return sock.disconnect(true);
|
||||
setTimeout(function () {
|
||||
sock.disconnect(true);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}).catch(function (err) {
|
||||
|
|
Loading…
Reference in New Issue