mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
Wait for all notebook models to load before shutting down active sessions during python upgrade (#17766)
* handle undefined model * wait for kernel to load before restart * comment * await editor model resolved * remove cast
This commit is contained in:
@@ -417,6 +417,10 @@ export abstract class NotebookInput extends EditorInput implements INotebookInpu
|
||||
}
|
||||
}
|
||||
|
||||
get modelResolved(): Promise<void> {
|
||||
return this._modelResolved.promise;
|
||||
}
|
||||
|
||||
private hookDirtyListener(dirtyEvent: Event<void>, listener: (e: any) => void): void {
|
||||
let disposable = dirtyEvent(listener);
|
||||
if (this._dirtyListener) {
|
||||
|
||||
@@ -223,6 +223,9 @@ CommandsRegistry.registerCommand({
|
||||
|
||||
for (let editor of editors) {
|
||||
if (editor instanceof NotebookInput) {
|
||||
// Wait for NotebookInput.resolve() to be called to ensure the _model field in NotebookInput
|
||||
// is not undefined when trying to get the notebookModel.
|
||||
await editor.modelResolved;
|
||||
let model: INotebookModel = editor.notebookModel;
|
||||
if (model?.providerId === JUPYTER_PROVIDER_ID) {
|
||||
let jupyterNotebookManager: IExecuteManager = model.executeManagers.find(x => x.providerId === JUPYTER_PROVIDER_ID);
|
||||
|
||||
Reference in New Issue
Block a user