fix: serialize rpc requests, no eager rewrites
This commit is contained in:
@@ -9,21 +9,31 @@ import { supervisor } from "./supervisor.ts";
|
||||
export async function serve(): Promise<void> {
|
||||
const socketPath = getSocketPath();
|
||||
mkdirSync(dirname(socketPath), { recursive: true });
|
||||
await supervisor.recoverAfterRestart();
|
||||
if (isRadiusEnabled()) {
|
||||
const machine = await radiusPresence.start();
|
||||
console.log(`radius integration enabled: ${socketPath} -> ${getRadiusOrchestratorBaseUrl()}`);
|
||||
if (machine) {
|
||||
console.log(`radius machine id: ${machine.id}`);
|
||||
}
|
||||
} else {
|
||||
console.log("radius integration disabled: login radius in ~/.pi/agent/auth.json or set PI_RADIUS_API_KEY");
|
||||
}
|
||||
const server = await startIpcServer(
|
||||
Object.assign(handleIpcRequest, {
|
||||
openRpcStream,
|
||||
}),
|
||||
);
|
||||
|
||||
try {
|
||||
await supervisor.recoverAfterRestart();
|
||||
if (isRadiusEnabled()) {
|
||||
const machine = await radiusPresence.start();
|
||||
console.log(`radius integration enabled: ${socketPath} -> ${getRadiusOrchestratorBaseUrl()}`);
|
||||
if (machine) {
|
||||
console.log(`radius machine id: ${machine.id}`);
|
||||
}
|
||||
} else {
|
||||
console.log("radius integration disabled: login radius in ~/.pi/agent/auth.json or set PI_RADIUS_API_KEY");
|
||||
}
|
||||
} catch (error) {
|
||||
server.close();
|
||||
if (existsSync(socketPath)) {
|
||||
unlinkSync(socketPath);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
console.log(`orchestrator listening on ${socketPath}`);
|
||||
|
||||
let shutdownPromise: Promise<void> | undefined;
|
||||
|
||||
Reference in New Issue
Block a user