diff --git a/src/expiring-groups.ts b/src/expiring-groups.ts index 80440b6..ee40936 100644 --- a/src/expiring-groups.ts +++ b/src/expiring-groups.ts @@ -54,10 +54,9 @@ export class ExpiringGroups { } /** 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.entries.set(key, { deadline: this.now() + this.timeout, group, weight }); - this.total += weight; + this.entries.set(key, { deadline: this.now() + this.timeout, group, weight: 0 }); if (this.sweeper) return; diff --git a/src/held-messages.ts b/src/held-messages.ts index a519d1a..cfacbd9 100644 --- a/src/held-messages.ts +++ b/src/held-messages.ts @@ -106,7 +106,8 @@ export class HeldMessages { 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; }