feat(v2): refactor reconnection probe to TCP-only and add frontend listeners
Replace attempt_ws_connect() with attempt_tcp_probe() in RemoteManager to avoid allocating per-connection resources (PtyManager, SidecarManager) on the relay during reconnection probes. Add onRemoteMachineReconnecting and onRemoteMachineReconnectReady event listeners in remote-bridge.ts. Wire machines store to auto-reconnect when relay becomes reachable.
This commit is contained in:
parent
218570ac35
commit
71100da125
3 changed files with 59 additions and 23 deletions
|
|
@ -9,6 +9,8 @@ import {
|
|||
onRemoteMachineReady,
|
||||
onRemoteMachineDisconnected,
|
||||
onRemoteError,
|
||||
onRemoteMachineReconnecting,
|
||||
onRemoteMachineReconnectReady,
|
||||
type RemoteMachineConfig,
|
||||
type RemoteMachineInfo,
|
||||
} from '../adapters/remote-bridge';
|
||||
|
|
@ -94,4 +96,22 @@ export async function initMachineListeners(): Promise<void> {
|
|||
notify('error', `Error from ${machine.label}: ${msg.error}`);
|
||||
}
|
||||
});
|
||||
|
||||
await onRemoteMachineReconnecting((msg) => {
|
||||
const machine = machines.find(m => m.id === msg.machineId);
|
||||
if (machine) {
|
||||
machine.status = 'reconnecting';
|
||||
notify('info', `Reconnecting to ${machine.label} in ${msg.backoffSecs}s…`);
|
||||
}
|
||||
});
|
||||
|
||||
await onRemoteMachineReconnectReady((msg) => {
|
||||
const machine = machines.find(m => m.id === msg.machineId);
|
||||
if (machine) {
|
||||
notify('info', `${machine.label} reachable — reconnecting…`);
|
||||
connectMachine(msg.machineId).catch((e) => {
|
||||
notify('error', `Auto-reconnect failed for ${machine.label}: ${e}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue