@tiflis-io/tiflis-code-workstation 0.3.14 → 0.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +16 -6
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2466,7 +2466,7 @@ var Session = class {
|
|
|
2466
2466
|
this._workspacePath = props.workspacePath;
|
|
2467
2467
|
this._workingDir = props.workingDir;
|
|
2468
2468
|
this._status = "active";
|
|
2469
|
-
this._createdAt = /* @__PURE__ */ new Date();
|
|
2469
|
+
this._createdAt = props.createdAt ?? /* @__PURE__ */ new Date();
|
|
2470
2470
|
this._lastActivityAt = /* @__PURE__ */ new Date();
|
|
2471
2471
|
}
|
|
2472
2472
|
get id() {
|
|
@@ -11328,7 +11328,7 @@ async function bootstrap() {
|
|
|
11328
11328
|
} catch (error) {
|
|
11329
11329
|
logger.error({ error }, "Failed to connect to tunnel (will retry)");
|
|
11330
11330
|
}
|
|
11331
|
-
const SHUTDOWN_TIMEOUT_MS =
|
|
11331
|
+
const SHUTDOWN_TIMEOUT_MS = 5e3;
|
|
11332
11332
|
let isShuttingDown = false;
|
|
11333
11333
|
const shutdown = async (signal) => {
|
|
11334
11334
|
if (isShuttingDown) {
|
|
@@ -11349,7 +11349,7 @@ async function bootstrap() {
|
|
|
11349
11349
|
logger.info("Terminating all sessions...");
|
|
11350
11350
|
const terminatePromise = sessionManager.terminateAll();
|
|
11351
11351
|
const sessionTimeoutPromise = new Promise((_, reject) => {
|
|
11352
|
-
setTimeout(() => reject(new Error("Session termination timeout")),
|
|
11352
|
+
setTimeout(() => reject(new Error("Session termination timeout")), 2e3);
|
|
11353
11353
|
});
|
|
11354
11354
|
try {
|
|
11355
11355
|
await Promise.race([terminatePromise, sessionTimeoutPromise]);
|
|
@@ -11360,7 +11360,7 @@ async function bootstrap() {
|
|
|
11360
11360
|
logger.info("Closing HTTP server...");
|
|
11361
11361
|
const closePromise = app.close();
|
|
11362
11362
|
const closeTimeoutPromise = new Promise((_, reject) => {
|
|
11363
|
-
setTimeout(() => reject(new Error("HTTP server close timeout")),
|
|
11363
|
+
setTimeout(() => reject(new Error("HTTP server close timeout")), 1e3);
|
|
11364
11364
|
});
|
|
11365
11365
|
try {
|
|
11366
11366
|
await Promise.race([closePromise, closeTimeoutPromise]);
|
|
@@ -11378,8 +11378,18 @@ async function bootstrap() {
|
|
|
11378
11378
|
process.exit(1);
|
|
11379
11379
|
}
|
|
11380
11380
|
};
|
|
11381
|
-
|
|
11382
|
-
|
|
11381
|
+
let signalCount = 0;
|
|
11382
|
+
const handleSignal = (signal) => {
|
|
11383
|
+
signalCount++;
|
|
11384
|
+
if (signalCount === 1) {
|
|
11385
|
+
void shutdown(signal);
|
|
11386
|
+
} else {
|
|
11387
|
+
logger.warn({ signal, count: signalCount }, "Force exit on repeated signal");
|
|
11388
|
+
process.exit(1);
|
|
11389
|
+
}
|
|
11390
|
+
};
|
|
11391
|
+
process.on("SIGTERM", () => handleSignal("SIGTERM"));
|
|
11392
|
+
process.on("SIGINT", () => handleSignal("SIGINT"));
|
|
11383
11393
|
process.on("unhandledRejection", (reason, promise) => {
|
|
11384
11394
|
logger.error({ reason, promise }, "Unhandled rejection");
|
|
11385
11395
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiflis-io/tiflis-code-workstation",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.17",
|
|
4
4
|
"description": "Workstation server for tiflis-code - manages agent sessions and terminal access",
|
|
5
5
|
"author": "Roman Barinov <rbarinov@gmail.com>",
|
|
6
6
|
"license": "FSL-1.1-NC",
|