mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-12 12:25:53 +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
|
||||
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(
|
||||
`macOS limit is 103 characters. Consider using shorter session IDs or control paths.`
|
||||
);
|
||||
return;
|
||||
throw error; // Fail fast instead of returning silently
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -800,15 +801,16 @@ export class PtyManager extends EventEmitter {
|
|||
clearTimeout(debounceTimer);
|
||||
}
|
||||
|
||||
debounceTimer = setTimeout(() => {
|
||||
const timer = setTimeout(() => {
|
||||
this.handleSessionJsonChange(session);
|
||||
// Clear both timer references after execution
|
||||
session.sessionJsonDebounceTimer = null;
|
||||
debounceTimer = null;
|
||||
}, 100);
|
||||
|
||||
// Update the session's timer reference
|
||||
session.sessionJsonDebounceTimer = debounceTimer;
|
||||
// Update both timer references
|
||||
session.sessionJsonDebounceTimer = timer;
|
||||
debounceTimer = timer;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue