Skip to content

Commit 5d7091f

Browse files
authored
timers: set several methods EOL
PR-URL: #56966 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
1 parent 3ea97d5 commit 5d7091f

10 files changed

+22
-262
lines changed

doc/api/deprecations.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,28 +2065,34 @@ method.
20652065

20662066
<!-- YAML
20672067
changes:
2068+
- version: REPLACEME
2069+
pr-url: https://github.com/nodejs/node/pull/56966
2070+
description: End-of-Life.
20682071
- version: v10.0.0
20692072
pr-url: https://github.com/nodejs/node/pull/18066
20702073
description: Runtime deprecation.
20712074
-->
20722075

2073-
Type: Runtime
2076+
Type: End-of-Life
20742077

2075-
`timers.enroll()` is deprecated. Please use the publicly documented
2078+
`timers.enroll()` has been removed. Please use the publicly documented
20762079
[`setTimeout()`][] or [`setInterval()`][] instead.
20772080

20782081
### DEP0096: `timers.unenroll()`
20792082

20802083
<!-- YAML
20812084
changes:
2085+
- version: REPLACEME
2086+
pr-url: https://github.com/nodejs/node/pull/56966
2087+
description: End-of-Life.
20822088
- version: v10.0.0
20832089
pr-url: https://github.com/nodejs/node/pull/18066
20842090
description: Runtime deprecation.
20852091
-->
20862092

2087-
Type: Runtime
2093+
Type: End-of-Life
20882094

2089-
`timers.unenroll()` is deprecated. Please use the publicly documented
2095+
`timers.unenroll()` has been removed. Please use the publicly documented
20902096
[`clearTimeout()`][] or [`clearInterval()`][] instead.
20912097

20922098
### DEP0097: `MakeCallback` with `domain` property
@@ -2613,14 +2619,17 @@ The `node:_stream_wrap` module is deprecated.
26132619

26142620
<!-- YAML
26152621
changes:
2622+
- version: REPLACEME
2623+
pr-url: https://github.com/nodejs/node/pull/56966
2624+
description: End-of-Life.
26162625
- version: v11.14.0
26172626
pr-url: https://github.com/nodejs/node/pull/26760
26182627
description: Runtime deprecation.
26192628
-->
26202629

2621-
Type: Runtime
2630+
Type: End-of-Life
26222631

2623-
The previously undocumented `timers.active()` is deprecated.
2632+
The previously undocumented `timers.active()` has been removed.
26242633
Please use the publicly documented [`timeout.refresh()`][] instead.
26252634
If re-referencing the timeout is necessary, [`timeout.ref()`][] can be used
26262635
with no performance impact since Node.js 10.
@@ -2629,14 +2638,17 @@ with no performance impact since Node.js 10.
26292638

26302639
<!-- YAML
26312640
changes:
2641+
- version: REPLACEME
2642+
pr-url: https://github.com/nodejs/node/pull/56966
2643+
description: End-of-Life.
26322644
- version: v11.14.0
26332645
pr-url: https://github.com/nodejs/node/pull/26760
26342646
description: Runtime deprecation.
26352647
-->
26362648

2637-
Type: Runtime
2649+
Type: End-of-Life
26382650

2639-
The previously undocumented and "private" `timers._unrefActive()` is deprecated.
2651+
The previously undocumented and "private" `timers._unrefActive()` has been removed.
26402652
Please use the publicly documented [`timeout.refresh()`][] instead.
26412653
If unreferencing the timeout is necessary, [`timeout.unref()`][] can be used
26422654
with no performance impact since Node.js 10.

lib/timers.js

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,14 @@ const {
4646
},
4747
kRefed,
4848
kHasPrimitive,
49-
getTimerDuration,
5049
timerListMap,
5150
timerListQueue,
5251
immediateQueue,
53-
active,
54-
unrefActive,
5552
insert,
5653
knownTimersById,
5754
} = require('internal/timers');
5855
const {
5956
promisify: { custom: customPromisify },
60-
deprecate,
6157
} = require('internal/util');
6258
let debug = require('internal/util/debuglog').debuglog('timer', (fn) => {
6359
debug = fn;
@@ -111,20 +107,6 @@ function unenroll(item) {
111107
item._idleTimeout = -1;
112108
}
113109

114-
// Make a regular object able to act as a timer by setting some properties.
115-
// This function does not start the timer, see `active()`.
116-
// Using existing objects as timers slightly reduces object overhead.
117-
function enroll(item, msecs) {
118-
msecs = getTimerDuration(msecs, 'msecs');
119-
120-
// If this item was already in a list somewhere
121-
// then we should unenroll it from that
122-
if (item._idleNext) unenroll(item);
123-
124-
L.init(item);
125-
item._idleTimeout = msecs;
126-
}
127-
128110

129111
/**
130112
* Schedules the execution of a one-time `callback`
@@ -351,23 +333,6 @@ module.exports = timers = {
351333
clearImmediate,
352334
setInterval,
353335
clearInterval,
354-
_unrefActive: deprecate(
355-
unrefActive,
356-
'timers._unrefActive() is deprecated.' +
357-
' Please use timeout.refresh() instead.',
358-
'DEP0127'),
359-
active: deprecate(
360-
active,
361-
'timers.active() is deprecated. Please use timeout.refresh() instead.',
362-
'DEP0126'),
363-
unenroll: deprecate(
364-
unenroll,
365-
'timers.unenroll() is deprecated. Please use clearTimeout instead.',
366-
'DEP0096'),
367-
enroll: deprecate(
368-
enroll,
369-
'timers.enroll() is deprecated. Please use setTimeout instead.',
370-
'DEP0095'),
371336
};
372337

373338
ObjectDefineProperties(timers, {

test/parallel/test-timers-active.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

test/parallel/test-timers-enroll-invalid-msecs.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

test/parallel/test-timers-enroll-second-time.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

test/parallel/test-timers-max-duration-warning.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const common = require('../common');
44
const assert = require('assert');
5-
const timers = require('timers');
65

76
const OVERFLOW = Math.pow(2, 31); // TIMEOUT_MAX is 2^31-1
87

@@ -19,7 +18,7 @@ process.on('warning', common.mustCall((warning) => {
1918
assert.strictEqual(lines[0], `${OVERFLOW} does not fit into a 32-bit signed` +
2019
' integer.');
2120
assert.strictEqual(lines.length, 2);
22-
}, 6));
21+
}, 2));
2322

2423

2524
{
@@ -31,12 +30,3 @@ process.on('warning', common.mustCall((warning) => {
3130
const interval = setInterval(timerNotCanceled, OVERFLOW);
3231
clearInterval(interval);
3332
}
34-
35-
{
36-
const timer = {
37-
_onTimeout: timerNotCanceled
38-
};
39-
timers.enroll(timer, OVERFLOW);
40-
timers.active(timer);
41-
timers.unenroll(timer);
42-
}

test/parallel/test-timers-unenroll-unref-interval.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const common = require('../common');
4-
const timers = require('timers');
54

65
{
76
const interval = setInterval(common.mustCall(() => {
@@ -17,7 +16,7 @@ const timers = require('timers');
1716

1817
{
1918
const interval = setInterval(common.mustCall(() => {
20-
timers.unenroll(interval);
19+
clearInterval(interval);
2120
}), 1).unref();
2221
}
2322

test/parallel/test-timers-unref-active.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

test/parallel/test-timers-unref-remove-other-unref-timers-only-one-fires.js

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)