shraga 0.1.33 → 0.1.34
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/package.json +1 -1
- package/src/server/boot.ts +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shraga",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"description": "The teammate you delegate coding to — a self-hostable, multi-user AI coding agent web UI (Claude Code, with a pluggable engine seam).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
package/src/server/boot.ts
CHANGED
|
@@ -2016,6 +2016,20 @@ try {
|
|
|
2016
2016
|
|
|
2017
2017
|
const PORT = Number(process.env.PORT) || 3032;
|
|
2018
2018
|
await new Promise<void>((resolve) => {
|
|
2019
|
+
// A listen failure MUST kill the process. Without this the error reaches the `uncaughtException`
|
|
2020
|
+
// handler above, which by design keeps us alive — so the promise never settles and we sit there
|
|
2021
|
+
// forever: process running, port unbound, nothing served. The service manager sees a healthy job
|
|
2022
|
+
// and a port watchdog sees a dead one, so it kickstarts on a loop and shreds in-flight runs.
|
|
2023
|
+
// EADDRINUSE is the common case: `kickstart -k` starts the replacement while the old process is
|
|
2024
|
+
// still draining (up to 90s). Exiting non-zero is the correct answer — the manager restarts us,
|
|
2025
|
+
// and by then the port is free.
|
|
2026
|
+
server.once('error', (err: NodeJS.ErrnoException) => {
|
|
2027
|
+
const why = err.code === 'EADDRINUSE'
|
|
2028
|
+
? `port ${PORT} is already in use (previous instance still draining?)`
|
|
2029
|
+
: (err.message ?? String(err));
|
|
2030
|
+
console.error(`[server] FATAL: cannot listen on ${PORT} — ${why}. Exiting so the service manager restarts us.`);
|
|
2031
|
+
process.exit(1);
|
|
2032
|
+
});
|
|
2019
2033
|
server.listen(PORT, () => {
|
|
2020
2034
|
console.log(`[server] Running on http://0.0.0.0:${PORT}`);
|
|
2021
2035
|
resolve();
|