MCPcopy Create free account
hub / github.com/nodejs/node / onTick

Function onTick

deps/undici/undici.js:1093–1120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1091 var PENDING = 0;
1092 var ACTIVE = 1;
1093 function onTick() {
1094 fastNow += TICK_MS;
1095 let idx = 0;
1096 let len = fastTimers.length;
1097 while (idx < len) {
1098 const timer = fastTimers[idx];
1099 if (timer._state === PENDING) {
1100 timer._idleStart = fastNow - TICK_MS;
1101 timer._state = ACTIVE;
1102 } else if (timer._state === ACTIVE && fastNow >= timer._idleStart + timer._idleTimeout) {
1103 timer._state = TO_BE_CLEARED;
1104 timer._idleStart = -1;
1105 timer._onTimeout(timer._timerArg);
1106 }
1107 if (timer._state === TO_BE_CLEARED) {
1108 timer._state = NOT_IN_LIST;
1109 if (--len !== 0) {
1110 fastTimers[idx] = fastTimers[len];
1111 }
1112 } else {
1113 ++idx;
1114 }
1115 }
1116 fastTimers.length = len;
1117 if (fastTimers.length !== 0) {
1118 refreshTimeout();
1119 }
1120 }
1121 __name(onTick, "onTick");
1122 function refreshTimeout() {
1123 if (fastNowTimeout?.refresh) {

Callers 1

tickFunction · 0.70

Calls 2

refreshTimeoutFunction · 0.70
_onTimeoutMethod · 0.45

Tested by

no test coverage detected