components:: sync:: SYNC_RESTART_TIMEOUT
const SYNC_RESTART_TIMEOUT: Duration;
Controls how long we wait to restart syncing after finishing a sync run.
This timeout should be long enough to:
allow pending downloads and verifies to complete or time out. Sync restarts don't cancel downloads, so quick restarts can overload network-bound nodes with lots of peers, leading to further failures. (The total number of requests being processed by peers is the sum of the number of peers, and the peer request buffer size.)
We assume that Zebra nodes have at least 10 Mbps bandwidth. So a maximum-sized block can take up to 2 seconds to download. Therefore, we set this timeout to twice the default number of peers. (The peer request buffer size is small enough that any buffered requests will overlap with the post-restart ObtainTips.)
allow zcashd peers to process pending requests. If the node only has a few peers, we want to clear as much peer state as possible. In particular, zcashd sends "next block range" hints, based on zcashd's internal model of our sync progress. But we want to discard these hints, so they don't get confused with ObtainTips and ExtendTips responses.
This timeout is particularly important on instances with slow or unreliable networks, and on testnet, which has a small number of slow peers.