Skip to content

Commit

Permalink
Temporary execution is created unnecessarily
Browse files Browse the repository at this point in the history
Fixes #10831
  • Loading branch information
roblourens committed Jul 15, 2022
1 parent 9afdb5b commit db96038
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/kernels/execution/cellExecutionMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { handleTensorBoardDisplayDataOutput } from './executionHelpers';
import { WIDGET_MIMETYPE } from '../ipywidgets/constants';
import isObject = require('lodash/isObject');
import { Identifiers } from '../../platform/common/constants';
import { Lazy } from '../../platform/common/utils/lazy';

// Helper interface for the set_next_input execute reply payload
interface ISetNextInputPayload {
Expand Down Expand Up @@ -521,7 +522,7 @@ export class CellExecutionMessageHandler implements IDisposable {
// Possible execution of cell has completed (the task would have been disposed).
// This message could have come from a background thread.
// In such circumstances, create a temporary task & use that to update the output (only cell execution tasks can update cell output).
const task = this.execution || this.createTemporaryTask();
let task = new Lazy(() => this.execution || this.createTemporaryTask());
this.clearLastUsedStreamOutput();
traceCellMessage(this.cell, 'Append output in addToCellData');
// If the output belongs to a widget, then add the output to that specific widget (i.e. just below the widget).
Expand Down Expand Up @@ -549,15 +550,15 @@ export class CellExecutionMessageHandler implements IDisposable {
.handlingCommId,
outputToAppend: cellOutput
},
task
task.getValue()
);

if (result?.outputAdded) {
outputShouldBeAppended = false;
}
}
if (outputShouldBeAppended) {
task?.appendOutput([cellOutput]).then(noop, noop);
task.getValue()?.appendOutput([cellOutput]).then(noop, noop);
}
this.endTemporaryTask();
}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/platform/vscode-path/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { LRUCachedComputed } from './cache';
import { CharCode } from './charCode';
import { Lazy } from './lazy';
import { Lazy } from '../common/utils/lazy';

export function compare(a: string, b: string): number {
if (a < b) {
Expand Down

0 comments on commit db96038

Please sign in to comment.