Skip to content

Commit e48f277

Browse files
authored
fix: add 60s timeout for RPC API calls (#76)
Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
1 parent f489c62 commit e48f277

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/miner-info.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ async function rpc (method, ...params) {
3333
params
3434
})
3535
})
36-
const res = await fetch(req)
36+
const res = await fetch(req, {
37+
signal: AbortSignal.timeout(60_000)
38+
})
3739

3840
if (!res.ok) {
3941
throw new Error(`JSON RPC failed with ${res.code}: ${(await res.text()).trimEnd()}`)

0 commit comments

Comments
 (0)