AikidoSec-safe-chain/packages/safe-chain/src/registryProxy/getConnectTimeout.js

13 lines
418 B
JavaScript

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;
}