Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
fix: remove tracked map as the stats overwrite each other (#217)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
achingbrain authored Sep 23, 2022
1 parent ccd3dc7 commit d5f4d5f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"benchmark": "^2.1.4",
Expand Down
5 changes: 2 additions & 3 deletions src/mplex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -71,11 +70,11 @@ export class MplexStreamMuxer implements StreamMuxer {
/**
* Stream to ids map
*/
initiators: trackedMap<number, MplexStream>({ metrics: components.getMetrics(), component: 'mplex', metric: 'initiatorStreams' }),
initiators: new Map<number, MplexStream>(),
/**
* Stream to ids map
*/
receivers: trackedMap<number, MplexStream>({ metrics: components.getMetrics(), component: 'mplex', metric: 'receiverStreams' })
receivers: new Map<number, MplexStream>()
}
this._init = init

Expand Down

0 comments on commit d5f4d5f

Please sign in to comment.