Skip to content

Commit

Permalink
timers: set several methods EOL
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Feb 8, 2025
1 parent b181535 commit e359ae6
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 254 deletions.
12 changes: 12 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,9 @@ method.

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/56966
description: End-of-Life.
- version: v10.0.0
pr-url: https://github.com/nodejs/node/pull/18066
description: Runtime deprecation.
Expand All @@ -2079,6 +2082,9 @@ Type: Runtime

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/56966
description: End-of-Life.
- version: v10.0.0
pr-url: https://github.com/nodejs/node/pull/18066
description: Runtime deprecation.
Expand Down Expand Up @@ -2613,6 +2619,9 @@ The `node:_stream_wrap` module is deprecated.

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/56966
description: End-of-Life.
- version: v11.14.0
pr-url: https://github.com/nodejs/node/pull/26760
description: Runtime deprecation.
Expand All @@ -2629,6 +2638,9 @@ with no performance impact since Node.js 10.

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/56966
description: End-of-Life.
- version: v11.14.0
pr-url: https://github.com/nodejs/node/pull/26760
description: Runtime deprecation.
Expand Down
35 changes: 0 additions & 35 deletions lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,14 @@ const {
},
kRefed,
kHasPrimitive,
getTimerDuration,
timerListMap,
timerListQueue,
immediateQueue,
active,
unrefActive,
insert,
knownTimersById,
} = require('internal/timers');
const {
promisify: { custom: customPromisify },
deprecate,
} = require('internal/util');
let debug = require('internal/util/debuglog').debuglog('timer', (fn) => {
debug = fn;
Expand Down Expand Up @@ -111,20 +107,6 @@ function unenroll(item) {
item._idleTimeout = -1;
}

// Make a regular object able to act as a timer by setting some properties.
// This function does not start the timer, see `active()`.
// Using existing objects as timers slightly reduces object overhead.
function enroll(item, msecs) {
msecs = getTimerDuration(msecs, 'msecs');

// If this item was already in a list somewhere
// then we should unenroll it from that
if (item._idleNext) unenroll(item);

L.init(item);
item._idleTimeout = msecs;
}


/**
* Schedules the execution of a one-time `callback`
Expand Down Expand Up @@ -351,23 +333,6 @@ module.exports = timers = {
clearImmediate,
setInterval,
clearInterval,
_unrefActive: deprecate(
unrefActive,
'timers._unrefActive() is deprecated.' +
' Please use timeout.refresh() instead.',
'DEP0127'),
active: deprecate(
active,
'timers.active() is deprecated. Please use timeout.refresh() instead.',
'DEP0126'),
unenroll: deprecate(
unenroll,
'timers.unenroll() is deprecated. Please use clearTimeout instead.',
'DEP0096'),
enroll: deprecate(
enroll,
'timers.enroll() is deprecated. Please use setTimeout instead.',
'DEP0095'),
};

ObjectDefineProperties(timers, {
Expand Down
34 changes: 0 additions & 34 deletions test/parallel/test-timers-active.js

This file was deleted.

38 changes: 0 additions & 38 deletions test/parallel/test-timers-enroll-invalid-msecs.js

This file was deleted.

16 changes: 0 additions & 16 deletions test/parallel/test-timers-enroll-second-time.js

This file was deleted.

12 changes: 1 addition & 11 deletions test/parallel/test-timers-max-duration-warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const common = require('../common');
const assert = require('assert');
const timers = require('timers');

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

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


{
Expand All @@ -31,12 +30,3 @@ process.on('warning', common.mustCall((warning) => {
const interval = setInterval(timerNotCanceled, OVERFLOW);
clearInterval(interval);
}

{
const timer = {
_onTimeout: timerNotCanceled
};
timers.enroll(timer, OVERFLOW);
timers.active(timer);
timers.unenroll(timer);
}
3 changes: 1 addition & 2 deletions test/parallel/test-timers-unenroll-unref-interval.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const common = require('../common');
const timers = require('timers');

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

{
const interval = setInterval(common.mustCall(() => {
timers.unenroll(interval);
clearInterval(interval);
}), 1).unref();
}

Expand Down
47 changes: 0 additions & 47 deletions test/parallel/test-timers-unref-active.js

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions test/parallel/test-timers-unref-remove-other-unref-timers.js

This file was deleted.

0 comments on commit e359ae6

Please sign in to comment.