Skip to content

Commit 9b62ab0

Browse files
committed
timers: use HandleWrap::Unrefed
1 parent e19c5dd commit 9b62ab0

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

lib/timers.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ function insert(item, unrefed) {
133133
list = new TimersList(msecs, unrefed);
134134
L.init(list);
135135
list._timer._list = list;
136-
137-
if (unrefed === true) list._timer.unref();
138136
list._timer.start(msecs, 0);
139137

140138
lists[msecs] = list;
@@ -149,7 +147,7 @@ function TimersList(msecs, unrefed) {
149147
this._idleNext = null; // Create the list with the linkedlist properties to
150148
this._idlePrev = null; // prevent any unnecessary hidden class changes.
151149
this._timer = new TimerWrap();
152-
this._unrefed = unrefed;
150+
if (unrefed === true) this._timer.unref();
153151
this.msecs = msecs;
154152
}
155153

@@ -206,12 +204,12 @@ function listOnTimeout() {
206204
// As such, we can remove the list and clean up the TimerWrap C++ handle.
207205
debug('%d list empty', msecs);
208206
assert(L.isEmpty(list));
209-
this.close();
210-
if (list._unrefed === true) {
211-
delete unrefedLists[msecs];
212-
} else {
207+
if (list._timer.isRefed() === true) {
213208
delete refedLists[msecs];
209+
} else {
210+
delete unrefedLists[msecs];
214211
}
212+
this.close();
215213
}
216214

217215

0 commit comments

Comments
 (0)