MCPcopy Index your code
hub / github.com/nodejs/node / timeout

Function timeout

test/parallel/test-dns-resolver-max-timeout.js:64–74  ·  view source on GitHub ↗
(address, options)

Source from the content-addressed store, hash-verified

62}));
63
64async function timeout(address, options) {
65 const start = Date.now();
66 const resolver = new dns.promises.Resolver(options);
67 resolver.setServers([`127.0.0.1:${address.port}`]);
68 try {
69 await resolver.resolveAny(nxdomain);
70 } catch (e) {
71 assert.strictEqual(e.code, 'ETIMEOUT');
72 return Date.now() - start;
73 }
74}

Calls 2

nowMethod · 0.80
setServersMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…