bitfab-cli 0.2.276 → 0.2.278
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.
- package/dist/index.js +8 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10440,6 +10440,10 @@ function readPid(pidPath) {
|
|
|
10440
10440
|
return null;
|
|
10441
10441
|
}
|
|
10442
10442
|
}
|
|
10443
|
+
var systemWaitClock = {
|
|
10444
|
+
now: Date.now,
|
|
10445
|
+
sleep: (delayMs) => new Promise((resolve4) => setTimeout(resolve4, delayMs))
|
|
10446
|
+
};
|
|
10443
10447
|
async function pingSocket(socketPath) {
|
|
10444
10448
|
return new Promise((resolve4) => {
|
|
10445
10449
|
const timeout = setTimeout(() => {
|
|
@@ -10480,14 +10484,14 @@ async function waitForSocket(socketPath, timeoutMs) {
|
|
|
10480
10484
|
}
|
|
10481
10485
|
throw new Error(`daemon did not become ready within ${timeoutMs}ms`);
|
|
10482
10486
|
}
|
|
10483
|
-
async function waitForLockHolderDaemon(socketPath, timeoutMs, localBuild = localBuildFingerprint()) {
|
|
10484
|
-
const deadline =
|
|
10485
|
-
while (
|
|
10487
|
+
async function waitForLockHolderDaemon(socketPath, timeoutMs, localBuild = localBuildFingerprint(), clock = systemWaitClock) {
|
|
10488
|
+
const deadline = clock.now() + timeoutMs;
|
|
10489
|
+
while (clock.now() < deadline) {
|
|
10486
10490
|
const ping = await pingSocket(socketPath);
|
|
10487
10491
|
if (ping.alive && buildMatches(localBuild, ping.build)) {
|
|
10488
10492
|
return;
|
|
10489
10493
|
}
|
|
10490
|
-
await
|
|
10494
|
+
await clock.sleep(ENSURE_POLL_INTERVAL_MS);
|
|
10491
10495
|
}
|
|
10492
10496
|
const finalPing = await pingSocket(socketPath);
|
|
10493
10497
|
if (finalPing.alive) {
|