-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: test peer connection management #3049
Conversation
You can find the image built from this PR at
Built from 7b25036 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks amazing! Thanks so much!
Added a small question :)
reconnectDurationWithBackoffPeriod > | ||
(reconnectDuration + backoffPeriod.seconds.float) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand why this is true. Shouldn't they be theoretically equal, but in practice any of them be longer than the other one?
Or in other words, why reconnectDuration + backoffPeriod.seconds.float
can't be greater than reconnectDurationWithBackoffPeriod
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand why this is true. Shouldn't they be theoretically equal, but in practice any of them be longer than the other one?
Or in other words, why
reconnectDuration + backoffPeriod.seconds.float
can't be greater thanreconnectDurationWithBackoffPeriod
?
Actually, in both cases we are doing the same operation but, in when the backoff
time assigned is != 0, then we add this extra block:
if backoffTime > ZeroDuration:
debug "Backing off before reconnect",
peerId = peerInfo.peerId, backoffTime = backoffTime
# We disconnected recently and still need to wait for a backoff period before connecting
await sleepAsync(backoffTime)
... where we are adding an extra backoffTime
plus the time spent in the debug
call plus the if statement. Hence, the >
condition should happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm I think that this can be problematic, the only difference is the if
statement, the log and the time it takes to return from the sleep after the time has passed.
But for example, if the call to await pm.connectToNodes(@[peerInfo])
in the case without the backoff for some reason takes longer than in the run with the backoff, it can happen that the statement won't be true.
So given that it can be false in certain cases and that I don't think that the check adds much, I would personally remove it. But if not we can keep it and remove it if we see that it gives problems :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Morning! ah yes , makes sense. For now I just simplified the test in 772131e
Thanks!
Description
Enhance reconnect logic and fix reconnect tests.
The important point is that it is necessary to set a port different than zero in tests.
Changes
Issue
closes