Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: heliaInstance.libp2p.addEventListener('peer:discovery', cb) calls cb twice for same peer #56

Closed
SgtPooki opened this issue Mar 16, 2023 · 1 comment

Comments

@SgtPooki
Copy link
Member

Peer discovery should only emit once, unless we are in fact discovering the peer twice via different methods somehow.

Either way, once a peer is discovered, we should cancel any in-progress operations and emit that we discovered the peer only once.

While working on a new helia-script-tag example (via #43), I was able to get the following event log:

1263ms - Created LibP2P instance
1263ms - Created Helia instance
2248ms - Discovered peer QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN
2252ms - Discovered peer QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN
2252ms - Discovered peer QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa
2252ms - Discovered peer QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa
2253ms - Discovered peer QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb
2254ms - Discovered peer QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb
2254ms - Discovered peer QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
2254ms - Discovered peer QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
74326ms - Connected to QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb
77805ms - Connected to QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
135298ms - Disconnected from QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb
138782ms - Disconnected from QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
@achingbrain
Copy link
Member

Completely agree, but please can you open an issue on libp2p/js-libp2p for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants