Skip to content

Commit 146e8ac

Browse files
apapirovskiMylesBorins
authored andcommitted
timers: remove domain specific code
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 <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent 935eac1 commit 146e8ac

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/timers.js

-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,6 @@ Timeout.prototype.unref = function() {
603603
this._handle.owner = this;
604604
this._handle[kOnTimeout] = unrefdHandle;
605605
this._handle.start(delay);
606-
this._handle.domain = this.domain;
607606
this._handle.unref();
608607
}
609608
return this;

test/parallel/test-domain-timers.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@ timeoutd.on('error', common.mustCall(function(e) {
3030
assert.strictEqual(e.message, 'Timeout UNREFd',
3131
'Domain should catch timer error');
3232
clearTimeout(timeout);
33-
}));
33+
}, 2));
3434

35+
let t;
3536
timeoutd.run(function() {
3637
setTimeout(function() {
3738
throw new Error('Timeout UNREFd');
3839
}, 0).unref();
40+
41+
t = setTimeout(function() {
42+
throw new Error('Timeout UNREFd');
43+
}, 0);
3944
});
45+
t.unref();
4046

4147
const immediated = domain.create();
4248

0 commit comments

Comments
 (0)