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

Function refreshTimeout

deps/undici/src/lib/util/timers.js:190–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

188}
189
190function refreshTimeout () {
191 // If the fastNowTimeout is already set and the Timer has the refresh()-
192 // method available, call it to refresh the timer.
193 // Some timer objects returned by setTimeout may not have a .refresh()
194 // method (e.g. mocked timers in tests).
195 if (fastNowTimeout?.refresh) {
196 fastNowTimeout.refresh()
197 // fastNowTimeout is not instantiated yet or refresh is not availabe,
198 // create a new Timer.
199 } else {
200 clearTimeout(fastNowTimeout)
201 fastNowTimeout = setTimeout(onTick, TICK_MS)
202 // If the Timer has an unref method, call it to allow the process to exit,
203 // if there are no other active handles. When using fake timers or mocked
204 // environments (like Jest), .unref() may not be defined,
205 fastNowTimeout?.unref()
206 }
207}
208
209/**
210 * The `FastTimer` class is a data structure designed to store and manage

Callers 2

onTickFunction · 0.70
refreshMethod · 0.70

Calls 4

clearTimeoutFunction · 0.70
setTimeoutFunction · 0.70
refreshMethod · 0.45
unrefMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…