mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
fix: Improve timer management and error handling in PTY manager
- Fix timer management in setupSessionJsonWatcher to properly assign timer before setTimeout - Improve IPC socket error handling to throw error instead of silently returning - Socket path length validation now fails fast with clear error message
This commit is contained in:
parent
6e18fa94e9
commit
dd4e06f249
1 changed files with 6 additions and 4 deletions
|
|
@ -695,11 +695,12 @@ export class PtyManager extends EventEmitter {
|
||||||
|
|
||||||
// Verify the socket path isn't too long
|
// Verify the socket path isn't too long
|
||||||
if (socketPath.length > 103) {
|
if (socketPath.length > 103) {
|
||||||
|
const error = new Error(`Socket path too long: ${socketPath.length} characters`);
|
||||||
logger.error(`Socket path too long (${socketPath.length} chars): ${socketPath}`);
|
logger.error(`Socket path too long (${socketPath.length} chars): ${socketPath}`);
|
||||||
logger.error(
|
logger.error(
|
||||||
`macOS limit is 103 characters. Consider using shorter session IDs or control paths.`
|
`macOS limit is 103 characters. Consider using shorter session IDs or control paths.`
|
||||||
);
|
);
|
||||||
return;
|
throw error; // Fail fast instead of returning silently
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -800,15 +801,16 @@ export class PtyManager extends EventEmitter {
|
||||||
clearTimeout(debounceTimer);
|
clearTimeout(debounceTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
debounceTimer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
this.handleSessionJsonChange(session);
|
this.handleSessionJsonChange(session);
|
||||||
// Clear both timer references after execution
|
// Clear both timer references after execution
|
||||||
session.sessionJsonDebounceTimer = null;
|
session.sessionJsonDebounceTimer = null;
|
||||||
debounceTimer = null;
|
debounceTimer = null;
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
// Update the session's timer reference
|
// Update both timer references
|
||||||
session.sessionJsonDebounceTimer = debounceTimer;
|
session.sessionJsonDebounceTimer = timer;
|
||||||
|
debounceTimer = timer;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue