Skip to content
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

Only store peers in CONNECTED or CONNECTING states #2275

Merged
merged 24 commits into from
Oct 19, 2022
Merged

Conversation

dguenther
Copy link
Member

@dguenther dguenther commented Sep 29, 2022

Summary

Opening this as a draft to give some visibility into the work here.

TODO

  • Move connectionRetry out of Peer so we don't have to keep disconnected Peers
  • Move disconnectUntil out of Peer so we don't have to keep disconnected Peers
  • Measure memory usage before + after
  • Cap number of peerCandidates in the peerCandidateMap?
  • If memory usage is improved, write a doc + clean it up
  • Re-enable fetching Peers on a timer
  • Remove tryDispose function
  • Fix tests

Testing Plan

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.

[ ] Yes

@dguenther dguenther marked this pull request as ready for review October 13, 2022 17:40
@dguenther dguenther requested a review from a team as a code owner October 13, 2022 17:40
@dguenther dguenther changed the title WIP - Only store peers in CONNECTED or CONNECTING states Only store peers in CONNECTED or CONNECTING states Oct 13, 2022
@@ -424,19 +397,6 @@ export class Peer {

this._address = address
this._port = port

if (address === null && port === null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we've removed this logic but we aren't calling PeerManager.getConnectionRetry.neverRetryConnecting in place of removing this logic. Is that what we want to do? We call setWebSocketAddress in a few places where I don't think this logic has been replaced

@dguenther dguenther merged commit 39d4878 into staging Oct 19, 2022
@dguenther dguenther deleted the no-known-peers branch October 19, 2022 23:40
existingConnection.close(new NetworkError(error))
}
}

/**
* Sets a WebSocket connection on the peer, moving it into the CONNECTING state if necessary.
* Ignores the connection if the peer already has a WebSocket connection.
* @param connection The WebSocket connection to set
*/
setWebSocketConnection(connection: WebSocketConnection): void {
if (this.state.type !== 'DISCONNECTED' && this.state.connections.webSocket) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log line updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants