mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Add tests for: not shortcircuiting timeout on imds endpoint.
This commit is contained in:
parent
afc68618c6
commit
40650e7912
3 changed files with 94 additions and 28 deletions
13
packages/safe-chain/src/registryProxy/getConnectTimeout.js
Normal file
13
packages/safe-chain/src/registryProxy/getConnectTimeout.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { isImdsEndpoint } from "./isImdsEndpoint.js";
|
||||
|
||||
/**
|
||||
* Returns appropriate connection timeout for a host.
|
||||
* - IMDS endpoints: 3s (fail fast when outside cloud, reduce 5min delay to ~20s)
|
||||
* - Other endpoints: 30s (allow for slow networks while preventing indefinite hangs)
|
||||
*/
|
||||
export function getConnectTimeout(/** @type {string} */ host) {
|
||||
if (isImdsEndpoint(host)) {
|
||||
return 3000;
|
||||
}
|
||||
return 30000;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue