@@ -55,9 +55,6 @@ delete process._scheduledImmediateCount;
55
55
const activateImmediateCheck = process . _activateImmediateCheck ;
56
56
delete process . _activateImmediateCheck ;
57
57
58
- // Timeout values > TIMEOUT_MAX are set to 1.
59
- const TIMEOUT_MAX = timerInternals . TIMEOUT_MAX ;
60
-
61
58
// The Timeout class
62
59
const Timeout = timerInternals . Timeout ;
63
60
@@ -392,29 +389,12 @@ const unenroll = exports.unenroll = function(item) {
392
389
// This function does not start the timer, see `active()`.
393
390
// Using existing objects as timers slightly reduces object overhead.
394
391
exports . enroll = function ( item , msecs ) {
395
- if ( typeof msecs !== 'number' ) {
396
- throw new errors . TypeError ( 'ERR_INVALID_ARG_TYPE' , 'msecs' ,
397
- 'number' , msecs ) ;
398
- }
399
-
400
- if ( msecs < 0 || ! isFinite ( msecs ) ) {
401
- throw new errors . RangeError ( 'ERR_VALUE_OUT_OF_RANGE' , 'msecs' ,
402
- 'a non-negative finite number' , msecs ) ;
403
- }
392
+ item . _idleTimeout = timerInternals . validateTimerDuration ( msecs ) ;
404
393
405
394
// if this item was already in a list somewhere
406
395
// then we should unenroll it from that
407
396
if ( item . _idleNext ) unenroll ( item ) ;
408
397
409
- // Ensure that msecs fits into signed int32
410
- if ( msecs > TIMEOUT_MAX ) {
411
- process . emitWarning ( `${ msecs } does not fit into a 32-bit signed integer.` +
412
- `\nTimer duration was truncated to ${ TIMEOUT_MAX } .` ,
413
- 'TimeoutOverflowWarning' ) ;
414
- msecs = TIMEOUT_MAX ;
415
- }
416
-
417
- item . _idleTimeout = msecs ;
418
398
L . init ( item ) ;
419
399
} ;
420
400
0 commit comments