From 037ceeaea232c640548ecf68de666f3013566005 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 23 Sep 2022 10:35:41 +0100 Subject: [PATCH] fix: remove tracked map as the stats overwrite each other The stats are useless since every connection has a stream muxer but they all record stats to the same keys meaning they overwrite each other. --- package.json | 1 - src/mplex.ts | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b85dbe7..2b2f63c 100644 --- a/package.json +++ b/package.json @@ -150,7 +150,6 @@ "@libp2p/interface-connection": "^3.0.1", "@libp2p/interface-stream-muxer": "^2.0.0", "@libp2p/logger": "^2.0.0", - "@libp2p/tracked-map": "^2.0.0", "abortable-iterator": "^4.0.2", "any-signal": "^3.0.0", "err-code": "^3.0.1", diff --git a/src/mplex.ts b/src/mplex.ts index 34abe72..d679e3e 100644 --- a/src/mplex.ts +++ b/src/mplex.ts @@ -7,7 +7,6 @@ import { restrictSize } from './restrict-size.js' import { MessageTypes, MessageTypeNames, Message } from './message-types.js' import { createStream } from './stream.js' import { toString as uint8ArrayToString } from 'uint8arrays' -import { trackedMap } from '@libp2p/tracked-map' import { logger } from '@libp2p/logger' import errCode from 'err-code' import { RateLimiterMemory } from 'rate-limiter-flexible' @@ -71,11 +70,11 @@ export class MplexStreamMuxer implements StreamMuxer { /** * Stream to ids map */ - initiators: trackedMap({ metrics: components.getMetrics(), component: 'mplex', metric: 'initiatorStreams' }), + initiators: new Map(), /** * Stream to ids map */ - receivers: trackedMap({ metrics: components.getMetrics(), component: 'mplex', metric: 'receiverStreams' }) + receivers: new Map() } this._init = init