timers: remove domain specific code

It is no longer necessary to explicitly set the handle
to inherit the Timeout domain.

PR-URL: https://github.com/nodejs/node/pull/18477
Refs: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Anatoli Papirovski 2018-01-29 14:52:01 -05:00
parent 7020bc6e07
commit fc96743454
No known key found for this signature in database
GPG Key ID: 614E2E1ABEB4B2C0
2 changed files with 7 additions and 2 deletions

View File

@ -586,7 +586,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;

View File

@ -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();