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

Cleanup sessions on Multisig Broker Server #5480

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

mat-if
Copy link
Contributor

@mat-if mat-if commented Oct 3, 2024

Summary

  • Added logic on the server to check if a session has 0 connected clients when a client disconnects. If it does, it will delete the session
  • Added a connected response from the server to the client when a client connects. Previously, it was sending the join session message immediately after connecting, which would lead to the message getting lost in the void

Closes IFL-3022

Testing Plan

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference
)? If yes, link a
related documentation pull request for the website.

[ ] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and label it with breaking-change-rpc or breaking-change-sdk.

[ ] Yes

@mat-if mat-if requested a review from a team as a code owner October 3, 2024 18:20
@mat-if mat-if force-pushed the mat/cleanup-broker-sessions branch from 36479c0 to cd90e54 Compare October 3, 2024 18:23
* session should still be considered active
*/
private isSessionActive(sessionId: string): boolean {
for (const client of this.clients.values()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Keeping this in mind for a followup task - do you think we should store a list of client IDs on the session? Here and in broadcast we iterate through all of the clients and filter out the ones that aren't in the right session 🫣

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I think that'd be a good change. I imagine we'll eventually get more and more logic around that, so having it easily accessible will be good.

Comment on lines 115 to 121
multisigClient.onConnectedMessage.on(() => {
if (sessionId) {
Assert.isNotNull(multisigClient)
multisigClient.joinSession(sessionId)
multisigClient.onConnectedMessage.clear()
}
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we block on waiting for a confirmed connection? If the connected message gets dropped for some reason then we'll continue without ever joining the session. Maybe that's being too paranoid about dropped messages 😅

@mat-if mat-if merged commit 9db89b3 into staging Oct 3, 2024
9 checks passed
@mat-if mat-if deleted the mat/cleanup-broker-sessions branch October 3, 2024 19:36
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.

2 participants