celestiaorg / celestiaorg/celestia-node

share/discovery: overly aggressive retrying

Open
#2,703 4 comments 0 reactions 0 assignees View on GitHub
area:p2p area:shares
Dominant language
Go
Stars
996
Forks
1.1k
Avg merge
1d 6h
Merged PRs (30d)
34

Description

I was looking into the mocha network today and found out a few things we need to change in discovery:
* We retry too often.
* If we cannot get the needed value of peers, we retry every second. Instant retries are usually useless; no new peers would join the network or advertise themselves in the second timeframe. But they are not always useless, so
* Instead, we should have a capped linear backoff.
* Factor 5 starting from 5 seconds and capped by 10 mins
* #2573 introduced a minor bug: `discoveryLoop` does not listen to `triggerDisc` channel anymore
* We should aim to trigger `discoveryLoop` asynchronously. RIght now, we endlessly trigger the loop every second, even if we have enough peers. Instead, we should rely more on `triggerDisc` channel to reduce wasted cycles. (nice-to-have)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.