Skip to content

Commit ddd5bd7

Browse files
committed
max tries
1 parent 6723c6b commit ddd5bd7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/krypton/krypton-env.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export interface KryptonContext {
3636
}
3737

3838
async function standByForPoxToBeReady(client: StacksCoreRpcClient): Promise<void> {
39+
const maxFailures = 10;
40+
let failures = 0;
3941
while (true) {
4042
try {
4143
const poxInfo = await client.getPox();
@@ -44,6 +46,10 @@ async function standByForPoxToBeReady(client: StacksCoreRpcClient): Promise<void
4446
}
4547
break;
4648
} catch (error) {
49+
failures += 1;
50+
if (failures >= maxFailures) {
51+
throw error;
52+
}
4753
console.log(`Waiting on PoX-4 to be ready, retrying after ${error}`);
4854
await timeout(500);
4955
}

0 commit comments

Comments
 (0)