@@ -289,10 +289,12 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
289289===================================================================
290290--- sagemaker-code-editor.orig/vscode/src/vs/server/node/webClientServer.ts
291291+++ sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
292- @@ -4,6 +4,7 @@
292+ @@ -3,7 +3,8 @@
293+ * Licensed under the MIT License. See License.txt in the project root for license information.
293294 *--------------------------------------------------------------------------------------------*/
294295
295- import { createReadStream } from 'fs';
296+ - import { createReadStream } from 'fs';
297+ + import { createReadStream, existsSync, writeFileSync } from 'fs';
296298+ import {readFile } from 'fs/promises';
297299 import { Promises } from 'vs/base/node/pfs';
298300 import * as path from 'path';
@@ -323,7 +325,7 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
323325 if (pathname === this._callbackRoute) {
324326 // callback support
325327 return this._handleCallback(res);
326- @@ -451,6 +457,23 @@ export class WebClientServer {
328+ @@ -451,6 +457,31 @@ export class WebClientServer {
327329 });
328330 return void res.end(data);
329331 }
@@ -335,6 +337,14 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
335337+ try {
336338+ const tmpDirectory = '/tmp/'
337339+ const idleFilePath = path.join(tmpDirectory, '.sagemaker-last-active-timestamp');
340+ +
341+ + // If idle shutdown file does not exist, this indicates the app UI may never been opened
342+ + // Create the initial metadata file
343+ + if (!existsSync(idleFilePath)) {
344+ + const timestamp = new Date().toISOString();
345+ + writeFileSync(idleFilePath, timestamp);
346+ + }
347+ +
338348+ const data = await readFile(idleFilePath, 'utf8');
339349+
340350+ res.statusCode = 200;
0 commit comments