Skip to content

Commit

Permalink
Force comm reconnect when comm is closed (e.g. kernel restarts, etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
halleysfifthinc committed Nov 26, 2024
1 parent bb621aa commit 8824ce6
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,15 @@ class WebIONotebookManager {
if (stat === "restarting" || stat === "autorestarting" || stat === "dead") {
// Stop attempting to handle callbacks if previous kernel is gone
this._webIO.setSendCallback((msg: any) => {});

// Close comm to force a re-connect to the new/restarted kernel
this.comm!.close();
}
}, this);
this.comm.onClose = (msg: any) => {
// Undefine comm so that the next connect call creates a new comm
this.comm = undefined;
}

this.setWebIOMetadata(kernel.id, this.comm.commId);
}
Expand Down

0 comments on commit 8824ce6

Please sign in to comment.