@phreshos/cli 0.1.27 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,11 +18,14 @@ export async function gatewayReady(path) {
|
|
|
18
18
|
}
|
|
19
19
|
export async function waitForGateway(path, running, timeout = 15_000) {
|
|
20
20
|
const until = Date.now() + timeout;
|
|
21
|
+
let observedRunning = false;
|
|
21
22
|
while (Date.now() < until) {
|
|
22
23
|
if (await gatewayReady(path))
|
|
23
24
|
return;
|
|
24
|
-
|
|
25
|
+
const isRunning = await running();
|
|
26
|
+
if (observedRunning && !isRunning)
|
|
25
27
|
throw new Error("The PhreshOS System stopped before its gateway became ready");
|
|
28
|
+
observedRunning ||= isRunning;
|
|
26
29
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
27
30
|
}
|
|
28
31
|
throw new Error(`The PhreshOS System did not become ready within ${Math.ceil(timeout / 1000)} seconds`);
|