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

Method refresh

deps/undici/src/lib/util/timers.js:286–303  ·  view source on GitHub ↗

* Sets the timer's start time to the current time, and reschedules the timer * to call its callback at the previously specified duration adjusted to the * current time. * Using this on a timer that has already called its callback will reactivate * the timer. * * @returns {void}

()

Source from the content-addressed store, hash-verified

284 * @returns {void}
285 */
286 refresh () {
287 // In the special case that the timer is not in the list of active timers,
288 // add it back to the array to be processed in the next tick by the onTick
289 // function.
290 if (this._state === NOT_IN_LIST) {
291 fastTimers.push(this)
292 }
293
294 // If the timer is the only active timer, refresh the fastNowTimeout for
295 // better resolution.
296 if (!fastNowTimeout || fastTimers.length === 1) {
297 refreshTimeout()
298 }
299
300 // Setting the state to PENDING will cause the timer to be reset in the
301 // next tick by the onTick function.
302 this._state = PENDING
303 }
304
305 /**
306 * The `clear` method cancels the timer, preventing it from executing.

Callers 9

constructorMethod · 0.95
setTimeoutMethod · 0.45
resumeMethod · 0.45
onHeadersCompleteMethod · 0.45
onBodyMethod · 0.45
writeMethod · 0.45
endMethod · 0.45
#scheduleFlushMethod · 0.45
refreshTimeoutFunction · 0.45

Calls 2

refreshTimeoutFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected