Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b1a4201a7d | |||
| 7117c91eab |
@@ -54,10 +54,9 @@ export class ExpiringGroups<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Starts the group's deadline, and the sweeper if this is the only group held. */
|
/** Starts the group's deadline, and the sweeper if this is the only group held. */
|
||||||
set(key: string, group: T, weight = 0): void {
|
set(key: string, group: T): void {
|
||||||
this.remove(key);
|
this.remove(key);
|
||||||
this.entries.set(key, { deadline: this.now() + this.timeout, group, weight });
|
this.entries.set(key, { deadline: this.now() + this.timeout, group, weight: 0 });
|
||||||
this.total += weight;
|
|
||||||
|
|
||||||
if (this.sweeper) return;
|
if (this.sweeper) return;
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,8 @@ export class HeldMessages {
|
|||||||
this.log.warn('heldMessages - replacing a message on a re-used sequence number', { seqNr: Number(key) });
|
this.log.warn('heldMessages - replacing a message on a re-used sequence number', { seqNr: Number(key) });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.held.set(key, pduObjs, pduObjs.reduce((sum, pduObj) => sum + retainedOctets(pduObj), 0));
|
this.held.set(key, pduObjs);
|
||||||
|
this.held.weigh(key, pduObjs.reduce((sum, pduObj) => sum + retainedOctets(pduObj), 0));
|
||||||
|
|
||||||
return hold;
|
return hold;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1508,6 +1508,7 @@ describe('held message bounds', () => {
|
|||||||
held.hold(message(2), 1);
|
held.hold(message(2), 1);
|
||||||
|
|
||||||
assert.equal(held.size, 2);
|
assert.equal(held.size, 2);
|
||||||
|
assert.equal(held.octetsHeld, 2 * 1026, 'the replaced message leaves its octets with it');
|
||||||
assert.equal(held.full(), true);
|
assert.equal(held.full(), true);
|
||||||
assert.equal(first.isHeld(), true);
|
assert.equal(first.isHeld(), true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user