timer-wheel
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -53,5 +53,5 @@ "use strict"; | ||
}; | ||
ReschedulingTimerWheel.prototype.removeNode = function (node) { | ||
ReschedulingTimerWheel.prototype.expireNode = function (node) { | ||
this.items.delete(node.data); | ||
_super.prototype.removeNode.call(this, node); | ||
_super.prototype.expireNode.call(this, node); | ||
}; | ||
@@ -58,0 +58,0 @@ ReschedulingTimerWheel.prototype.scheduleNode = function (node) { |
@@ -140,5 +140,5 @@ "use strict"; | ||
var next = node.next; | ||
this.removeNode(node); | ||
if (node.time <= time) { | ||
// This node has expired, add it to the queue | ||
this.expireNode(node); | ||
expired.push(node.data); | ||
@@ -149,5 +149,3 @@ } | ||
var b = this.findBucket(node); | ||
if (b) { | ||
node.appendToTail(b); | ||
} | ||
node.appendToTail(b); | ||
} | ||
@@ -174,7 +172,7 @@ node = next; | ||
remove: function () { | ||
self.removeNode(node); | ||
self.expireNode(node); | ||
} | ||
}; | ||
}; | ||
TimerWheel.prototype.removeNode = function (node) { | ||
TimerWheel.prototype.expireNode = function (node) { | ||
node.remove(); | ||
@@ -181,0 +179,0 @@ }; |
@@ -36,5 +36,5 @@ import { TimerWheel } from './timer-wheel'; | ||
} | ||
removeNode(node) { | ||
expireNode(node) { | ||
this.items.delete(node.data); | ||
super.removeNode(node); | ||
super.expireNode(node); | ||
} | ||
@@ -41,0 +41,0 @@ scheduleNode(node) { |
@@ -134,5 +134,5 @@ import { TimerNode } from './timer-node'; | ||
const next = node.next; | ||
this.removeNode(node); | ||
if (node.time <= time) { | ||
// This node has expired, add it to the queue | ||
this.expireNode(node); | ||
expired.push(node.data); | ||
@@ -143,5 +143,3 @@ } | ||
const b = this.findBucket(node); | ||
if (b) { | ||
node.appendToTail(b); | ||
} | ||
node.appendToTail(b); | ||
} | ||
@@ -168,7 +166,7 @@ node = next; | ||
remove() { | ||
self.removeNode(node); | ||
self.expireNode(node); | ||
} | ||
}; | ||
} | ||
removeNode(node) { | ||
expireNode(node) { | ||
node.remove(); | ||
@@ -175,0 +173,0 @@ } |
@@ -27,5 +27,5 @@ import { TimerWheel } from './timer-wheel'; | ||
unschedule(data: T): boolean; | ||
protected removeNode(node: TimerNode<T>): void; | ||
protected expireNode(node: TimerNode<T>): void; | ||
protected scheduleNode(node: TimerNode<T>): import("./handle").TimerHandle; | ||
} | ||
//# sourceMappingURL=rescheduling-timer-wheel.d.ts.map |
@@ -62,4 +62,4 @@ import { TimerNode } from './timer-node'; | ||
protected scheduleNode(node: TimerNode<T>): TimerHandle; | ||
protected removeNode(node: TimerNode<T>): void; | ||
protected expireNode(node: TimerNode<T>): void; | ||
} | ||
//# sourceMappingURL=timer-wheel.d.ts.map |
{ | ||
"name": "timer-wheel", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Timer wheel for managing expiration of a large amount of items", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -46,6 +46,6 @@ import { TimerWheel } from './timer-wheel'; | ||
protected removeNode(node: TimerNode<T>) { | ||
protected expireNode(node: TimerNode<T>) { | ||
this.items.delete(node.data); | ||
super.removeNode(node); | ||
super.expireNode(node); | ||
} | ||
@@ -52,0 +52,0 @@ |
@@ -157,6 +157,6 @@ import { TimerNode } from './timer-node'; | ||
const next = node.next; | ||
this.removeNode(node); | ||
if(node.time <= time) { | ||
// This node has expired, add it to the queue | ||
this.expireNode(node); | ||
expired.push(node.data); | ||
@@ -166,5 +166,3 @@ } else { | ||
const b = this.findBucket(node); | ||
if(b) { | ||
node.appendToTail(b); | ||
} | ||
node.appendToTail(b); | ||
} | ||
@@ -195,3 +193,3 @@ node = next; | ||
remove() { | ||
self.removeNode(node); | ||
self.expireNode(node); | ||
} | ||
@@ -201,5 +199,5 @@ }; | ||
protected removeNode(node: TimerNode<T>): void { | ||
protected expireNode(node: TimerNode<T>): void { | ||
node.remove(); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
58580
1182