From 664b13da3289597966bfb5b7dd5e347233d48524 Mon Sep 17 00:00:00 2001 From: Evan Wiederspan Date: Tue, 13 Dec 2022 11:20:16 -0800 Subject: [PATCH] Don't recreate a model on channel open if the model already exists (#31) We believe this to be the root cause of https://github.com/googlecolab/colabtools/issues/3270. --- src/manager.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/manager.ts b/src/manager.ts index 0120db4..b6d5ddd 100644 --- a/src/manager.ts +++ b/src/manager.ts @@ -229,6 +229,11 @@ export class Manager extends ManagerBase implements IWidgetManager { return; } const classicComm = new ClassicComm(id, comm); + if (this.models.has(id)) { + // This model has already been created, skip calling handle_com_open which + // would re-create it. + return; + } await this.handle_comm_open(classicComm, { header: {} as services.KernelMessage.IHeader<'comm_open'>, metadata: {version: base.PROTOCOL_VERSION},