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

streamr-1.0 fix-start-and-stop-of-autocertifier-client #2182

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ptesavol
Copy link
Collaborator

@ptesavol ptesavol commented Dec 8, 2023

This is the fix-start-and-stop-of-autocertifier-client pull request moved to base upon streamr-1.0 instead of testnet-one

  • make test/end-to-end/RecoveryFromFailedAutoCertification.test.ts to stop the entrypoint last to prevent nodes from starting to reconnect through the stopped entrypoint at the end of the test
  • rename WebsocketConnector's autoCertify() method to startAutoCertifierClient() as this is what the method does
  • stop AutoCertifierClientFacade in WebsocketConnector if it was started
  • start AutoCertifierClient in AutoCertifierClientFacade using an abortable withTimeout() instead of waitForEvent3 (using a async function as waitForEvent3 predicate caused the timeout to keep running in case the predicate threw an exception, which was the reason for test/end-to-end/RecoveryFromFailedAutoCertification.test.ts to hang)
  • because of the above changes test/end-to-end/RecoveryFromFailedAutoCertification.test.ts does not hang anymore

@github-actions github-actions bot added the dht Related to DHT package label Dec 8, 2023
@@ -36,7 +36,6 @@ export interface IAutoCertifierClient {
stop(): void
on(eventName: string, cb: (subdomain: CertifiedSubdomain) => void): void
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Keep this line

const requests = Array.from(this.ongoingConnectRequests.values())
await Promise.allSettled(requests.map((conn) => conn.close(false)))
if (this.autoCertifierClient) {
await this.autoCertifierClient.stop()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
await this.autoCertifierClient.stop()
this.autoCertifierClient.stop()

// all paths of this.autoCertifierClient.start() will block until 'updatedCertificate'
// event is emitted or an exception is thrown

await withTimeout(this.autoCertifierClient.start(), START_TIMEOUT,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should separate the starting of the client and obtaining the initial certificate. It doesn't take long time to start the client, but in practice we wait for the certificate?

Also could rename AutoCertifierClientFacade to AutoCertifierFacade as we don't seem to use any of the client's functionality methods (we just call the start and stop methods).

-> maybe in a separate PR

Base automatically changed from streamr-1.0 to main December 27, 2023 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dht Related to DHT package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants