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

Method setTimeout

deps/undici/undici.js:7197–7218  ·  view source on GitHub ↗
(delay, type)

Source from the content-addressed store, hash-verified

7195 this.maxResponseSize = client[kMaxResponseSize];
7196 }
7197 setTimeout(delay, type) {
7198 if (delay !== this.timeoutValue || type & USE_FAST_TIMER ^ this.timeoutType & USE_FAST_TIMER) {
7199 if (this.timeout) {
7200 timers.clearTimeout(this.timeout);
7201 this.timeout = null;
7202 }
7203 if (delay) {
7204 if (type & USE_FAST_TIMER) {
7205 this.timeout = timers.setFastTimeout(onParserTimeout, delay, this.timeoutWeakRef);
7206 } else {
7207 this.timeout = setTimeout(onParserTimeout, delay, this.timeoutWeakRef);
7208 this.timeout?.unref();
7209 }
7210 }
7211 this.timeoutValue = delay;
7212 } else if (this.timeout) {
7213 if (this.timeout.refresh) {
7214 this.timeout.refresh();
7215 }
7216 }
7217 this.timeoutType = type;
7218 }
7219 resume() {
7220 if (this.socket.destroyed || !this.paused) {
7221 return;

Calls 3

setTimeoutFunction · 0.70
unrefMethod · 0.45
refreshMethod · 0.45

Tested by

no test coverage detected