celestiaorg / celestia-node

Celestia Data Availability Nodes
Apache License 2.0
911 stars 900 forks source link

feat(discovery): discover triggered too frequently #3550

Open guillaumemichel opened 1 week ago

guillaumemichel commented 1 week ago

In the case a node doesn't have its quota of peers, it will send a new discover request every second. There are no guarantees that the discover request can complete within 1 second.

https://github.com/celestiaorg/celestia-node/blob/accb0589d2de42a44de43e0974610d3a0186976d/share/p2p/discovery/discovery.go#L225-L229

This interval seems too aggressive and should probably be increased (e.g to 1 or even 5 minutes?)

renaynay commented 1 week ago

@guillaumemichel i agree that the interval for retrying is a bit too aggressive and could be increased, but the actual deadline to FindPeers is a minute.

https://github.com/celestiaorg/celestia-node/blob/accb0589d2de42a44de43e0974610d3a0186976d/share/p2p/discovery/discovery.go#L286-L293

guillaumemichel commented 1 week ago

So basically there will always be a lookup running until enough peers are discovered.

Wondertan commented 1 week ago

So basically there will always be a lookup running until enough peers are discovered.

IIRC, that was the intention, but as you mentioned that might be too aggressive