Skip to content

Commit

Permalink
Don't recreate a model on channel open if the model already exists (#31)
Browse files Browse the repository at this point in the history
We believe this to be the root cause of
googlecolab/colabtools#3270.
  • Loading branch information
EvanWiederspan authored Dec 13, 2022
1 parent 3ecefb8 commit 664b13d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 664b13d

Please sign in to comment.