-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rationale: Before this commit, the internal loop exited if: - the expected amount of peers is found, or, - the iterator returns `false` (exhaustion), or - `batchSize` iterations are done. The issue with the iterations count is, in case not enough peer are found AND `iterator.Next` always returns `true`, we don't control WHEN the loop is going to stop. The root cause is we don't control the time needed to run the `iterator.Next` function, which is a function of `devp2P (geth)`. The value of `batchSize (2000)` was chosen arbitrarily. It turns out the time needed to run `iterator.Next` can go from a few micro seconds to a few hundreds of milliseconds. ==> In small networks (example: E2E tests), it was possible for the loop not to exit during several dozen of seconds. With this commit, we replace the `batchSize` by a `batchPeriod`, ensuring the loop will never run longer than `batchPeriod`, even in a small network. Co-authored-by: Nishant Das <[email protected]>
- Loading branch information
Showing
5 changed files
with
11 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters