Skip to content

Commit 307d0ba

Browse files
authored
fix: pass metrics to peerstore (#3164)
Allow the peerstore to record metrics
1 parent dbbc6ef commit 307d0ba

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/libp2p/src/libp2p.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,16 @@ export class Libp2p<T extends ServiceMap = ServiceMap> extends TypedEventEmitter
8686
dns: init.dns
8787
})
8888

89-
this.peerStore = this.configureComponent('peerStore', persistentPeerStore(components, {
90-
addressFilter: this.components.connectionGater.filterMultiaddrForPeer,
91-
...init.peerStore
92-
}))
93-
9489
// Create Metrics
9590
if (init.metrics != null) {
9691
this.metrics = this.configureComponent('metrics', init.metrics(this.components))
9792
}
9893

94+
this.peerStore = this.configureComponent('peerStore', persistentPeerStore(components, {
95+
addressFilter: this.components.connectionGater.filterMultiaddrForPeer,
96+
...init.peerStore
97+
}))
98+
9999
components.events.addEventListener('peer:update', evt => {
100100
// if there was no peer previously in the peer store this is a new peer
101101
if (evt.detail.previous == null) {

0 commit comments

Comments
 (0)