Skip to content

Commit 255ae89

Browse files
committed
clear websocket attribute without waiting for previous websocket to finish closing
which may never finish
1 parent 3fb26ad commit 255ae89

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

notebook/static/services/kernels/kernel.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -576,18 +576,13 @@ define([
576576
*
577577
* @function stop_channels
578578
*/
579-
var that = this;
580-
var close = function () {
581-
if (that.ws && that.ws.readyState === WebSocket.CLOSED) {
582-
that.ws = null;
583-
}
584-
};
585579
if (this.ws !== null) {
586-
if (this.ws.readyState === WebSocket.OPEN) {
587-
this.ws.onclose = close;
588-
this.ws.close();
589-
} else {
590-
close();
580+
var ws = this.ws;
581+
this.ws = null;
582+
if (ws.readyState === WebSocket.OPEN) {
583+
// unregister onclose callbacks
584+
ws.onclose = function () {};
585+
ws.close();
591586
}
592587
}
593588
};

0 commit comments

Comments
 (0)