Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timers: cleanup interval handling #1272

Closed
wants to merge 2 commits into from
Closed
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
Prev Previous commit
timers: cleanup interval handling
Uses `null` as the false-y value for `_repeat` as like other properties.
Removes un-reachable statement in setInterval’s `wrapper()`.

PR-URL: #1272
Reviewed-by: Trevor Norris <[email protected]>
Fishrock123 committed Mar 26, 2015
commit bb2a99b0756fb2ddb25585c75127c55f7948f815
6 changes: 2 additions & 4 deletions lib/timers.js
Original file line number Diff line number Diff line change
@@ -272,8 +272,6 @@ exports.setInterval = function(callback, repeat) {

function wrapper() {
timer._repeat.call(this);
// If callback called clearInterval().
if (timer._repeat === null) return;
// If timer is unref'd (or was - it's permanently removed from the list.)
if (this._handle) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mucked this up. Fedor is fixing it as part of #1330

this._handle.start(repeat, 0);
@@ -287,7 +285,7 @@ exports.setInterval = function(callback, repeat) {

exports.clearInterval = function(timer) {
if (timer && timer._repeat) {
timer._repeat = false;
timer._repeat = null;
clearTimeout(timer);
}
};
@@ -300,7 +298,7 @@ const Timeout = function(after) {
this._idleNext = this;
this._idleStart = null;
this._onTimeout = null;
this._repeat = false;
this._repeat = null;
};

Timeout.prototype.unref = function() {