@khanglvm/relay 0.13.3 → 0.13.4
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.js +12 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanglvm/relay",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.4",
|
|
4
4
|
"description": "Question boards with rich blocks (markdown, charts, mermaid, tables, code, diffs, video, sandboxed HTML), clickable local file-links, and element-level annotations for AI coding agents (Claude Code, Codex, …): ask users structured questions, present interactive visuals, collect inline comments, read answers as JSON — in a local browser board OR rendered INLINE inside the Claude & Codex apps as an MCP App (SEP-1865).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
package/src/server.js
CHANGED
|
@@ -694,13 +694,22 @@ export async function runBoard({ id, port = 0, open = true, timeoutSec = 1800, q
|
|
|
694
694
|
});
|
|
695
695
|
|
|
696
696
|
// Bind the requested port (reopen/rescue reuse the board's last port so a
|
|
697
|
-
// still-open tab reconnects).
|
|
698
|
-
//
|
|
697
|
+
// still-open tab reconnects). A board just stopped on that port holds its
|
|
698
|
+
// listening socket through a short close grace, so a stop-then-reopen on the
|
|
699
|
+
// same port can briefly hit EADDRINUSE — retry for ~2s to ride that out before
|
|
700
|
+
// giving up. Only then fall back to a random free port rather than failing.
|
|
699
701
|
await new Promise((resolve, reject) => {
|
|
702
|
+
const RETRY_MS = 200;
|
|
703
|
+
const MAX_RETRIES = 10; // ~2s — covers a prior server's ~600ms close grace
|
|
704
|
+
let retries = 0;
|
|
700
705
|
const bind = (p, allowFallback) => {
|
|
701
706
|
const onErr = (e) => {
|
|
702
707
|
if (allowFallback && e && e.code === 'EADDRINUSE' && p !== 0) {
|
|
703
|
-
|
|
708
|
+
if (retries++ < MAX_RETRIES) {
|
|
709
|
+
setTimeout(() => bind(p, true), RETRY_MS); // port freeing up — retry it
|
|
710
|
+
} else {
|
|
711
|
+
bind(0, false); // still busy after retries → random free port
|
|
712
|
+
}
|
|
704
713
|
} else {
|
|
705
714
|
reject(e);
|
|
706
715
|
}
|