This repository has been archived by the owner on Oct 31, 2024. It is now read-only.
fix(p2p): rework ticks of bootstrap query interval #483
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR reworks how we manage the ticks of the bootstrap queries.
After investigating an issue on
devnet
I saw that two queries were executed at the same second.While the expected behavior is to have a delay of 60sec (by default).
Why ?
As we can see on the logs, the first query
(1)
fails, and we switch to fast mode for bootstrap as expected.But the problem is that after changing the mode (basically, creating a new
interval
with shorter period), the next query(2)
is directly executed.This is due to the fact that the first
tick
ofinterval
completes immediately and then the discoverypoll
function fire a new query.Fix
To fix that I updated the
change_interval
to await and ignore the first tick and switch theMissedTickBehavior
todelay
as we don't need any catchup on missing tick.PR Checklist: