Skip to content

Commit

Permalink
fix: add 60s timeout for RPC API calls (#76)
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Bajtoš <[email protected]>
  • Loading branch information
bajtos authored Jun 12, 2024
1 parent f489c62 commit e48f277
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/miner-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ async function rpc (method, ...params) {
params
})
})
const res = await fetch(req)
const res = await fetch(req, {
signal: AbortSignal.timeout(60_000)
})

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

0 comments on commit e48f277

Please sign in to comment.