Skip to content

Commit d022524

Browse files
Port server cache fix to release (#9932)
1 parent 8805276 commit d022524

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747

4848
### Fixes
4949

50+
1. Use the autoStart server when available.
51+
([#9926](https://github.com/Microsoft/vscode-python/issues/9926))
5052
1. Removed unnecessary warning when executing cells that use Scrapbook,
5153
Fix an html crash when using not supported mime types
5254
([#9796](https://github.com/microsoft/vscode-python/issues/9796))

src/client/datascience/jupyter/liveshare/serverCache.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface IServerData {
1717
options: INotebookServerOptions;
1818
promise: Promise<INotebookServer | undefined>;
1919
cancelSource: CancellationTokenSource;
20+
resolved: boolean;
2021
}
2122

2223
export class ServerCache implements IAsyncDisposable {
@@ -43,7 +44,7 @@ export class ServerCache implements IAsyncDisposable {
4344

4445
// See if the old options had the same UI setting. If not,
4546
// cancel the old
46-
if (data && data.options.disableUI !== fixedOptions.disableUI) {
47+
if (data && !data.resolved && data.options.disableUI !== fixedOptions.disableUI) {
4748
traceInfo('Cancelling server create as UI state has changed');
4849
data.cancelSource.cancel();
4950
data = undefined;
@@ -55,7 +56,8 @@ export class ServerCache implements IAsyncDisposable {
5556
data = {
5657
promise: createFunction(options, cancelSource.token),
5758
options: fixedOptions,
58-
cancelSource
59+
cancelSource,
60+
resolved: false
5961
};
6062
this.cache.set(key, data);
6163
}
@@ -75,6 +77,11 @@ export class ServerCache implements IAsyncDisposable {
7577
return oldDispose();
7678
};
7779

80+
// We've resolved the promise at this point
81+
if (data) {
82+
data.resolved = true;
83+
}
84+
7885
return server;
7986
})
8087
.catch(e => {

0 commit comments

Comments
 (0)