timers: rename validateTimerDuration to getTimerDuration · nodejs/node@9e8c9be (original) (raw)
4 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -45,7 +45,7 @@ const { | ||
45 | 45 | ERR_INVALID_PROTOCOL, |
46 | 46 | ERR_UNESCAPED_CHARACTERS |
47 | 47 | } = require('internal/errors').codes; |
48 | -const { validateTimerDuration } = require('internal/timers'); | |
48 | +const { getTimerDuration } = require('internal/timers'); | |
49 | 49 | const is_reused_symbol = require('internal/freelist').symbols.is_reused_symbol; |
50 | 50 | const { |
51 | 51 | DTRACE_HTTP_CLIENT_REQUEST, |
@@ -146,7 +146,7 @@ function ClientRequest(input, options, cb) { | ||
146 | 146 | this.socketPath = options.socketPath; |
147 | 147 | |
148 | 148 | if (options.timeout !== undefined) |
149 | -this.timeout = validateTimerDuration(options.timeout, 'timeout'); | |
149 | +this.timeout = getTimerDuration(options.timeout, 'timeout'); | |
150 | 150 | |
151 | 151 | var method = options.method; |
152 | 152 | var methodIsString = (typeof method === 'string'); |
@@ -743,7 +743,7 @@ ClientRequest.prototype.setTimeout = function setTimeout(msecs, callback) { | ||
743 | 743 | } |
744 | 744 | |
745 | 745 | listenSocketTimeout(this); |
746 | -msecs = validateTimerDuration(msecs, 'msecs'); | |
746 | +msecs = getTimerDuration(msecs, 'msecs'); | |
747 | 747 | if (callback) this.once('timeout', callback); |
748 | 748 | |
749 | 749 | if (this.socket) { |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -21,7 +21,7 @@ const { owner_symbol } = require('internal/async_hooks').symbols; | ||
21 | 21 | const { |
22 | 22 | kTimeout, |
23 | 23 | setUnrefTimeout, |
24 | -validateTimerDuration | |
24 | +getTimerDuration | |
25 | 25 | } = require('internal/timers'); |
26 | 26 | |
27 | 27 | const kMaybeDestroy = Symbol('kMaybeDestroy'); |
@@ -205,7 +205,7 @@ function setStreamTimeout(msecs, callback) { | ||
205 | 205 | this.timeout = msecs; |
206 | 206 | |
207 | 207 | // Type checking identical to timers.enroll() |
208 | -msecs = validateTimerDuration(msecs, 'msecs'); | |
208 | +msecs = getTimerDuration(msecs, 'msecs'); | |
209 | 209 | |
210 | 210 | // Attempt to clear an existing timer in both cases - |
211 | 211 | // even if it will be rescheduled we don't want to leak an existing timer. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -359,7 +359,7 @@ function setUnrefTimeout(callback, after) { | ||
359 | 359 | } |
360 | 360 | |
361 | 361 | // Type checking used by timers.enroll() and Socket#setTimeout() |
362 | -function validateTimerDuration(msecs, name) { | |
362 | +function getTimerDuration(msecs, name) { | |
363 | 363 | validateNumber(msecs, name); |
364 | 364 | if (msecs < 0 | |
365 | 365 | throw new ERR_OUT_OF_RANGE(name, 'a non-negative finite number', msecs); |
@@ -586,7 +586,7 @@ module.exports = { | ||
586 | 586 | kRefed, |
587 | 587 | initAsyncResource, |
588 | 588 | setUnrefTimeout, |
589 | -validateTimerDuration, | |
589 | +getTimerDuration, | |
590 | 590 | immediateQueue, |
591 | 591 | getTimerCallbacks, |
592 | 592 | immediateInfoFields: { |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -36,7 +36,7 @@ const { | ||
36 | 36 | }, |
37 | 37 | kRefed, |
38 | 38 | initAsyncResource, |
39 | -validateTimerDuration, | |
39 | +getTimerDuration, | |
40 | 40 | timerListMap, |
41 | 41 | timerListQueue, |
42 | 42 | immediateQueue, |
@@ -102,7 +102,7 @@ function unenroll(item) { | ||
102 | 102 | // This function does not start the timer, see `active()`. |
103 | 103 | // Using existing objects as timers slightly reduces object overhead. |
104 | 104 | function enroll(item, msecs) { |
105 | -msecs = validateTimerDuration(msecs, 'msecs'); | |
105 | +msecs = getTimerDuration(msecs, 'msecs'); | |
106 | 106 | |
107 | 107 | // If this item was already in a list somewhere |
108 | 108 | // then we should unenroll it from that |