mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 03:11:25 +00:00
perf(test): reduce memory and port probe overhead
This commit is contained in:
@@ -42,8 +42,7 @@ export async function ensurePortAvailable(port: number): Promise<void> {
|
||||
});
|
||||
} catch (err) {
|
||||
if (isErrno(err) && err.code === "EADDRINUSE") {
|
||||
const details = await describePortOwner(port);
|
||||
throw new PortInUseError(port, details);
|
||||
throw new PortInUseError(port);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
@@ -57,7 +56,10 @@ export async function handlePortError(
|
||||
): Promise<never> {
|
||||
// Uniform messaging for EADDRINUSE with optional owner details.
|
||||
if (err instanceof PortInUseError || (isErrno(err) && err.code === "EADDRINUSE")) {
|
||||
const details = err instanceof PortInUseError ? err.details : await describePortOwner(port);
|
||||
const details =
|
||||
err instanceof PortInUseError
|
||||
? (err.details ?? (await describePortOwner(port)))
|
||||
: await describePortOwner(port);
|
||||
runtime.error(danger(`${context} failed: port ${port} is already in use.`));
|
||||
if (details) {
|
||||
runtime.error(info("Port listener details:"));
|
||||
|
||||
Reference in New Issue
Block a user