@cryptiklemur/lattice 1.40.4 → 1.40.6
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/server/src/daemon.ts +15 -1
- package/server/src/index.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cryptiklemur/lattice",
|
|
3
|
-
"version": "1.40.
|
|
3
|
+
"version": "1.40.6",
|
|
4
4
|
"description": "Multi-machine agentic dashboard for Claude Code. Monitor sessions, manage MCP servers and skills, orchestrate across mesh-networked nodes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Aaron Scherer <me@aaronscherer.me>",
|
package/server/src/daemon.ts
CHANGED
|
@@ -224,9 +224,13 @@ export async function startDaemon(portOverride?: number | null): Promise<void> {
|
|
|
224
224
|
|
|
225
225
|
var protocol = tlsOptions ? "https" : "http";
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
var maxRetries = 10;
|
|
228
|
+
for (var attempt = 0; attempt < maxRetries; attempt++) {
|
|
229
|
+
try {
|
|
230
|
+
Bun.serve<WsData>({
|
|
228
231
|
port: config.port,
|
|
229
232
|
hostname: "0.0.0.0",
|
|
233
|
+
reusePort: true,
|
|
230
234
|
...(tlsOptions ? { tls: tlsOptions } : {}),
|
|
231
235
|
|
|
232
236
|
async fetch(req: Request, server: ReturnType<typeof Bun.serve>) {
|
|
@@ -356,6 +360,16 @@ export async function startDaemon(portOverride?: number | null): Promise<void> {
|
|
|
356
360
|
},
|
|
357
361
|
},
|
|
358
362
|
});
|
|
363
|
+
break;
|
|
364
|
+
} catch (err: unknown) {
|
|
365
|
+
if (attempt < maxRetries - 1 && err instanceof Error && (err as any).code === "EADDRINUSE") {
|
|
366
|
+
log.server("Port %d in use, retrying in 1s (%d/%d)...", config.port, attempt + 1, maxRetries);
|
|
367
|
+
await new Promise(function (r) { setTimeout(r, 1000); });
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
throw err;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
359
373
|
|
|
360
374
|
log.server("Listening on %s://0.0.0.0:%d", protocol, config.port);
|
|
361
375
|
|
package/server/src/index.ts
CHANGED
|
@@ -121,10 +121,11 @@ async function runDaemon(): Promise<void> {
|
|
|
121
121
|
stopMeshConnections();
|
|
122
122
|
|
|
123
123
|
var waited = 0;
|
|
124
|
+
var maxWait = 2000;
|
|
124
125
|
var checkInterval = setInterval(function () {
|
|
125
126
|
var activeCount = getActiveStreamCount();
|
|
126
127
|
waited += 500;
|
|
127
|
-
if (activeCount === 0 || waited >=
|
|
128
|
+
if (activeCount === 0 || waited >= maxWait) {
|
|
128
129
|
clearInterval(checkInterval);
|
|
129
130
|
closeAllClients();
|
|
130
131
|
removePid();
|