mirror of
https://github.com/morluto/rea.git
synced 2026-11-06 06:46:10 +00:00
fix(hopper): wait for late bridges during cleanup (#1866)
This commit is contained in:
1 parent
1f531fc257
commit
cf7477eb46
8 files changed
+323
-205
No files matched your search
@@ -34,7 +34,10 @@ import type { ProgressReporter } from "../application/ProgressReporter.js";
|
||||
import { silentLogger } from "../logger.js";
|
||||
import type { Logger } from "pino";
|
||||
import { PrivateRuntimeRoot } from "../process/PrivateRuntimeRoot.js";
|
||||
import { ProviderStartupDeadline } from "../process/ProviderDeadline.js";
|
||||
import {
|
||||
ProviderStartupDeadline,
|
||||
waitForAbortableDelay,
|
||||
} from "../process/ProviderDeadline.js";
|
||||
import { redactCapturedTransportCredential } from "../process/ProviderDiagnosticRedaction.js";
|
||||
import { ProviderRunLineage } from "../process/ProviderRunLineage.js";
|
||||
import {
|
||||
@@ -423,7 +426,7 @@ export class HopperClient {
|
||||
);
|
||||
if (!health.ok) {
|
||||
return this.#startupFailure(
|
||||
deadline.signal.aborted
|
||||
deadline.signal.aborted || health.error instanceof HopperTimeoutError
|
||||
? await this.#startupInterruption(deadline)
|
||||
: health.error,
|
||||
);
|
||||
@@ -542,11 +545,28 @@ export class HopperClient {
|
||||
);
|
||||
this.#closing = true;
|
||||
try {
|
||||
const connected = await connectHopperSocketOnce(
|
||||
join(root.path, "bridge.sock"),
|
||||
const socketPath = join(root.path, "bridge.sock");
|
||||
let connected = await connectHopperSocketOnce(
|
||||
socketPath,
|
||||
controller.signal,
|
||||
);
|
||||
if (!connected.ok) return;
|
||||
while (!connected.ok) {
|
||||
const cause = connected.error.cause;
|
||||
if (
|
||||
!(
|
||||
cause instanceof Error &&
|
||||
"code" in cause &&
|
||||
(cause.code === "ENOENT" || cause.code === "ECONNREFUSED")
|
||||
)
|
||||
)
|
||||
return;
|
||||
if ((await waitForAbortableDelay(50, controller.signal)) === "aborted")
|
||||
return;
|
||||
connected = await connectHopperSocketOnce(
|
||||
socketPath,
|
||||
controller.signal,
|
||||
);
|
||||
}
|
||||
const socket = connected.value;
|
||||
this.#socket = socket;
|
||||
this.#attachSocket(socket);
|
||||
|
||||
Reference in new issue
Block a user