@@ -147,7 +147,7 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-idle-extension/src/exte
147147===================================================================
148148--- /dev/null
149149+++ sagemaker-code-editor/vscode/extensions/sagemaker-idle-extension/src/extension.ts
150- @@ -0,0 +1,116 @@
150+ @@ -0,0 +1,112 @@
151151+ import * as vscode from "vscode";
152152+ import * as fs from "fs";
153153+ import * as path from "path";
@@ -171,15 +171,11 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-idle-extension/src/exte
171171+
172172+ /**
173173+ * Initializes the file path where the idle timestamp will be stored.
174- + * It sets the path to a hidden file in the user's home directory.
174+ + * It sets the path to a hidden file in the /tmp/ directory.
175175+ */
176176+ function initializeIdleFilePath() {
177- + const homeDirectory = process.env.HOME || process.env.USERPROFILE;
178- + if (!homeDirectory) {
179- + console.log(`${LOG_PREFIX} Unable to determine the home directory.`);
180- + return;
181- + }
182- + idleFilePath = path.join(homeDirectory, ".sagemaker-last-active-timestamp");
177+ + const tmpDirectory = "/tmp/";
178+ + idleFilePath = path.join(tmpDirectory, ".sagemaker-last-active-timestamp");
183179+
184180+ // Set initial lastActivetimestamp
185181+ updateLastActivityTimestamp()
@@ -327,7 +323,7 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
327323 if (pathname === this._callbackRoute) {
328324 // callback support
329325 return this._handleCallback(res);
330- @@ -451,6 +457,27 @@ export class WebClientServer {
326+ @@ -451,6 +457,23 @@ export class WebClientServer {
331327 });
332328 return void res.end(data);
333329 }
@@ -337,12 +333,8 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
337333+ */
338334+ private async _handleIdle(req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {
339335+ try {
340- + const homeDirectory = process.env.HOME || process.env.USERPROFILE;
341- + if (!homeDirectory) {
342- + throw new Error('Home directory not found');
343- + }
344- +
345- + const idleFilePath = path.join(homeDirectory, '.sagemaker-last-active-timestamp');
336+ + const tmpDirectory = '/tmp/'
337+ + const idleFilePath = path.join(tmpDirectory, '.sagemaker-last-active-timestamp');
346338+ const data = await readFile(idleFilePath, 'utf8');
347339+
348340+ res.statusCode = 200;
0 commit comments