@@ -55,9 +55,6 @@ delete process._scheduledImmediateCount;
5555const activateImmediateCheck = process . _activateImmediateCheck ;
5656delete process . _activateImmediateCheck ;
5757
58- // Timeout values > TIMEOUT_MAX are set to 1.
59- const TIMEOUT_MAX = timerInternals . TIMEOUT_MAX ;
60-
6158// The Timeout class
6259const Timeout = timerInternals . Timeout ;
6360
@@ -392,29 +389,12 @@ const unenroll = exports.unenroll = function(item) {
392389// This function does not start the timer, see `active()`.
393390// Using existing objects as timers slightly reduces object overhead.
394391exports . 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 ) ;
404393
405394 // if this item was already in a list somewhere
406395 // then we should unenroll it from that
407396 if ( item . _idleNext ) unenroll ( item ) ;
408397
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 ;
418398 L . init ( item ) ;
419399} ;
420400
0 commit comments