diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-20 12:12:48 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-27 17:05:14 +0100 |
commit | 9e8c9be3ff07845320c350fa3b2097cfbdada85e (patch) | |
tree | 6318cf01e3b6c8407c6fdce3b35681d09dd8be8c /lib/internal | |
parent | 6c913fb0287fa7f823fcd0fbe7035bac3c4f75ec (diff) | |
download | android-node-v8-9e8c9be3ff07845320c350fa3b2097cfbdada85e.tar.gz android-node-v8-9e8c9be3ff07845320c350fa3b2097cfbdada85e.tar.bz2 android-node-v8-9e8c9be3ff07845320c350fa3b2097cfbdada85e.zip |
timers: rename validateTimerDuration to getTimerDuration
The function did not only validate the timer but it caused side
effects like a warning and potentially returned a different value
than the input value. Thus the name `validate` did not seem to be
appropriate.
PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal')
-rw-r--r-- | lib/internal/stream_base_commons.js | 4 | ||||
-rw-r--r-- | lib/internal/timers.js | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/internal/stream_base_commons.js b/lib/internal/stream_base_commons.js index 67abba0992..3f53e3903a 100644 --- a/lib/internal/stream_base_commons.js +++ b/lib/internal/stream_base_commons.js @@ -21,7 +21,7 @@ const { owner_symbol } = require('internal/async_hooks').symbols; const { kTimeout, setUnrefTimeout, - validateTimerDuration + getTimerDuration } = require('internal/timers'); const kMaybeDestroy = Symbol('kMaybeDestroy'); @@ -205,7 +205,7 @@ function setStreamTimeout(msecs, callback) { this.timeout = msecs; // Type checking identical to timers.enroll() - msecs = validateTimerDuration(msecs, 'msecs'); + msecs = getTimerDuration(msecs, 'msecs'); // Attempt to clear an existing timer in both cases - // even if it will be rescheduled we don't want to leak an existing timer. diff --git a/lib/internal/timers.js b/lib/internal/timers.js index c8d8e5a6c3..d485c3ff65 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -359,7 +359,7 @@ function setUnrefTimeout(callback, after) { } // Type checking used by timers.enroll() and Socket#setTimeout() -function validateTimerDuration(msecs, name) { +function getTimerDuration(msecs, name) { validateNumber(msecs, name); if (msecs < 0 || !isFinite(msecs)) { throw new ERR_OUT_OF_RANGE(name, 'a non-negative finite number', msecs); @@ -586,7 +586,7 @@ module.exports = { kRefed, initAsyncResource, setUnrefTimeout, - validateTimerDuration, + getTimerDuration, immediateQueue, getTimerCallbacks, immediateInfoFields: { |