Skip to content

Commit d65df37

Browse files
authored
feat(entropy-tester): set timeout for total testLatency function (#2781)
1 parent 3471777 commit d65df37

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

apps/entropy-tester/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/entropy-tester",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Utility to test entropy provider callbacks",
55
"type": "module",
66
"main": "dist/index.js",

apps/entropy-tester/src/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,18 @@ export const main = function () {
181181
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
182182
while (true) {
183183
try {
184-
await testLatency(contract, privateKey, child);
184+
await Promise.race([
185+
testLatency(contract, privateKey, child),
186+
new Promise((_, reject) =>
187+
setTimeout(() => {
188+
reject(
189+
new Error(
190+
"Timeout: 120s passed but testLatency function was not resolved",
191+
),
192+
);
193+
}, 120_000),
194+
),
195+
]);
185196
} catch (error) {
186197
child.error(error, "Error testing latency");
187198
}

0 commit comments

Comments
 (0)