We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b6e22c4 commit 0e06197Copy full SHA for 0e06197
lib/timers.js
@@ -301,6 +301,14 @@ const Timeout = function(after) {
301
this._repeat = null;
302
};
303
304
+
305
+function unrefdHandle() {
306
+ this.owner._onTimeout();
307
+ if (!this.owner.repeat)
308
+ this.owner.close();
309
+}
310
311
312
Timeout.prototype.unref = function() {
313
if (this._handle) {
314
this._handle.unref();
@@ -315,7 +323,8 @@ Timeout.prototype.unref = function() {
315
323
if (this._called && !this._repeat) return;
316
324
317
325
this._handle = new Timer();
318
- this._handle[kOnTimeout] = this._onTimeout;
326
+ this._handle.owner = this;
327
+ this._handle[kOnTimeout] = unrefdHandle;
319
328
this._handle.start(delay, 0);
320
329
this._handle.domain = this.domain;
321
330
0 commit comments