mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Add jupyter server shutdown timeout setting (#15913)
* add jupyter server shutdown timeout setting * no timeout if setting is 0 * set minimum value to 0
This commit is contained in:
@@ -17,6 +17,7 @@ export const pythonVersion = '3.8.10';
|
||||
export const pythonPathConfigKey = 'pythonPath';
|
||||
export const existingPythonConfigKey = 'useExistingPython';
|
||||
export const dontPromptPythonUpdate = 'dontPromptPythonUpdate';
|
||||
export const jupyterServerShutdownTimeoutConfigKey = 'jupyterServerShutdownTimeout';
|
||||
export const notebookConfigKey = 'notebook';
|
||||
export const trustedBooksConfigKey = 'trustedBooks';
|
||||
export const pinnedBooksConfigKey = 'pinnedNotebooks';
|
||||
|
||||
@@ -64,13 +64,17 @@ export class JupyterNotebookProvider implements nb.NotebookProvider {
|
||||
manager.sessionManager.shutdown(session.id);
|
||||
}
|
||||
if (sessionManager.listRunning().length === 0) {
|
||||
const TenMinutesInMs = 10 * 60 * 1000;
|
||||
setTimeout(() => {
|
||||
if (sessionManager.listRunning().length === 0) {
|
||||
this.managerTracker.delete(baseFolder);
|
||||
manager.dispose();
|
||||
}
|
||||
}, TenMinutesInMs);
|
||||
let notebookConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(constants.notebookConfigKey);
|
||||
let timeoutInMinutes: number = notebookConfig.get(constants.jupyterServerShutdownTimeoutConfigKey);
|
||||
if (timeoutInMinutes > 0) {
|
||||
const timeoutInMs = timeoutInMinutes * 60 * 1000;
|
||||
setTimeout(() => {
|
||||
if (sessionManager.listRunning().length === 0) {
|
||||
this.managerTracker.delete(baseFolder);
|
||||
manager.dispose();
|
||||
}
|
||||
}, timeoutInMs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user