@tiflis-io/tiflis-code-workstation 0.3.20 → 0.3.21
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 +29 -19
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -9206,6 +9206,34 @@ async function bootstrap() {
|
|
|
9206
9206
|
},
|
|
9207
9207
|
"Starting workstation server"
|
|
9208
9208
|
);
|
|
9209
|
+
const registerSignalHandlers = (shutdown2) => {
|
|
9210
|
+
let signalCount = 0;
|
|
9211
|
+
const handleSignal = (signal) => {
|
|
9212
|
+
signalCount++;
|
|
9213
|
+
logger.info({ signal, count: signalCount }, "Signal received, initiating shutdown");
|
|
9214
|
+
if (signalCount === 1) {
|
|
9215
|
+
console.log("\nShutting down gracefully...");
|
|
9216
|
+
shutdown2(signal).then(() => {
|
|
9217
|
+
process.exit(0);
|
|
9218
|
+
}).catch((error) => {
|
|
9219
|
+
logger.error({ error }, "Error during shutdown");
|
|
9220
|
+
process.exit(1);
|
|
9221
|
+
});
|
|
9222
|
+
} else {
|
|
9223
|
+
console.log("\nForce exiting...");
|
|
9224
|
+
process.exit(1);
|
|
9225
|
+
}
|
|
9226
|
+
};
|
|
9227
|
+
process.on("SIGTERM", () => handleSignal("SIGTERM"));
|
|
9228
|
+
process.on("SIGINT", () => handleSignal("SIGINT"));
|
|
9229
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
9230
|
+
logger.error({ reason, promise }, "Unhandled rejection");
|
|
9231
|
+
});
|
|
9232
|
+
process.on("uncaughtException", (error) => {
|
|
9233
|
+
logger.fatal({ error }, "Uncaught exception");
|
|
9234
|
+
process.exit(1);
|
|
9235
|
+
});
|
|
9236
|
+
};
|
|
9209
9237
|
const dataDir = env.DATA_DIR;
|
|
9210
9238
|
initDatabase(dataDir);
|
|
9211
9239
|
logger.info({ dataDir }, "Database initialized");
|
|
@@ -11338,25 +11366,7 @@ async function bootstrap() {
|
|
|
11338
11366
|
process.exit(1);
|
|
11339
11367
|
}
|
|
11340
11368
|
};
|
|
11341
|
-
|
|
11342
|
-
const handleSignal = (signal) => {
|
|
11343
|
-
signalCount++;
|
|
11344
|
-
if (signalCount === 1) {
|
|
11345
|
-
void shutdown(signal);
|
|
11346
|
-
} else {
|
|
11347
|
-
logger.warn({ signal, count: signalCount }, "Force exit on repeated signal");
|
|
11348
|
-
process.exit(1);
|
|
11349
|
-
}
|
|
11350
|
-
};
|
|
11351
|
-
process.on("SIGTERM", () => handleSignal("SIGTERM"));
|
|
11352
|
-
process.on("SIGINT", () => handleSignal("SIGINT"));
|
|
11353
|
-
process.on("unhandledRejection", (reason, promise) => {
|
|
11354
|
-
logger.error({ reason, promise }, "Unhandled rejection");
|
|
11355
|
-
});
|
|
11356
|
-
process.on("uncaughtException", (error) => {
|
|
11357
|
-
logger.fatal({ error }, "Uncaught exception");
|
|
11358
|
-
process.exit(1);
|
|
11359
|
-
});
|
|
11369
|
+
registerSignalHandlers(shutdown);
|
|
11360
11370
|
}
|
|
11361
11371
|
bootstrap().catch((error) => {
|
|
11362
11372
|
console.error("Failed to bootstrap:", error);
|
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.21",
|
|
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",
|