Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Sep 26, 2022
1 parent 0f73fa5 commit b37d24c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/notebooks/controllers/controllerLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ export class ControllerLoader implements IControllerLoader, IExtensionSyncActiva

// If we have any out of date connections, dispose of them
disposedControllers.forEach((controller) => {
traceInfoIfCI(`Disposing controller ${controller.id}`);
traceInfoIfCI(
`Disposing controller ${controller.id}, associated with connection ${controller.connection.id}`
);
controller.dispose(); // This should remove it from the registered list
});

Expand Down
3 changes: 2 additions & 1 deletion src/notebooks/controllers/controllerRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
} from '../../platform/common/types';
import { swallowExceptions } from '../../platform/common/utils/decorators';
import { IServiceContainer } from '../../platform/ioc/types';
import { traceError, traceWarning } from '../../platform/logging';
import { traceError, traceVerbose, traceWarning } from '../../platform/logging';
import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { NotebookCellLanguageService } from '../languages/cellLanguageService';
import { KernelFilterService } from './kernelFilter/kernelFilterService';
Expand Down Expand Up @@ -174,6 +174,7 @@ export class ControllerRegistration implements IControllerRegistration {
controller.onNotebookControllerSelectionChanged((e) => {
if (!e.selected && this.isFiltered(controller.connection)) {
// This item was selected but is no longer allowed in the kernel list. Remove it
traceVerbose(`Removing controller ${controller.id} from kernel list`);
controller.dispose();
}
});
Expand Down
8 changes: 8 additions & 0 deletions src/notebooks/controllers/vscodeNotebookController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ export class VSCodeNotebookController implements Disposable, IVSCodeNotebookCont
}

public dispose() {
traceVerbose(
`Disposing controller ${this.id} associated with connection ${
this.connection.id
} and documents ${this.notebookApi.notebookDocuments
.filter((item) => this.associatedDocuments.has(item))
.map((item) => item.uri.toString())
.join(', ')}`
);
if (!this.isDisposed) {
this.isDisposed = true;
this._onNotebookControllerSelected.dispose();
Expand Down

0 comments on commit b37d24c

Please sign in to comment.