Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the file name seems wrong now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok since unenroll is the function that these functions are calling. They're un-enrolling the timers.

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.

Loading