Skip to content

Peer-And-Content-Routing example: Remove or better document 100ms delay #950

Closed
@mcclure

Description

@mcclure

This example
https://github.com/libp2p/js-libp2p/blob/master/examples/peer-and-content-routing
Involves running two scripts simultaneously; they then connect to each other. Each one does this before calling findPeers

// The DHT routing tables need a moment to populate
await delay(100)

This is fine for an example/test but is not good enough for production code. There's no indication how to modify this 100ms delay when moving the example code into production code.

Expected behavior: There should be some other type of event— for example, js-libp2p-kad-dht announcing it has finished negotiating dht with the remote server— that can be awaited on, and the example should use it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: Good to have, but can wait until someone steps upeffort/hoursEstimated to take one or several hoursgood first issueGood issue for new contributorshelp wantedSeeking public contribution on this issuetopic/docsDocumentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions