Skip to content

Commit

Permalink
timers: remove domain specific code
Browse files Browse the repository at this point in the history
It is no longer necessary to explicitly set the handle
to inherit the Timeout domain.

PR-URL: #18477
Refs: #16222
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
  • Loading branch information
apapirovski authored and MylesBorins committed Feb 20, 2018
1 parent e079247 commit 3962051
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,6 @@ Timeout.prototype.unref = function() {
this._handle.owner = this;
this._handle[kOnTimeout] = unrefdHandle;
this._handle.start(delay);
this._handle.domain = this.domain;
this._handle.unref();
}
return this;
Expand Down
8 changes: 7 additions & 1 deletion test/parallel/test-domain-timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@ timeoutd.on('error', common.mustCall(function(e) {
assert.strictEqual(e.message, 'Timeout UNREFd',
'Domain should catch timer error');
clearTimeout(timeout);
}));
}, 2));

let t;
timeoutd.run(function() {
setTimeout(function() {
throw new Error('Timeout UNREFd');
}, 0).unref();

t = setTimeout(function() {
throw new Error('Timeout UNREFd');
}, 0);
});
t.unref();

const immediated = domain.create();

Expand Down

0 comments on commit 3962051

Please sign in to comment.