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

rpcserver: Use internal quit chan for ws sync. #2297

Merged

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Jul 25, 2020

This modifies the websocket notification manager to make use of the newer pattern that synchronizes the Run context with an internal quit channel to ensure that any exported functions that communicate with the goroutines can't possibly hang during shutdown.

This was previously done by storing the context in the struct (which is generally discouraged) and protecting it by a mutex which means every single notification had to take the mutex.

As can be seen by the diff of this commit, this approach is not only more performant, it's also less code.

@davecgh davecgh added this to the 1.6.0 milestone Jul 25, 2020
Copy link
Member

@dnldd dnldd left a comment

Choose a reason for hiding this comment

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

Looks good.

This modifies the websocket notification manager to make use of the
newer pattern that synchronizes the Run context with an internal quit
channel to ensure that any exported functions that communicate with the
goroutines can't possibly hang during shutdown.

This was previously done by storing the context in the struct (which is
generally discouraged) and protecting it by a mutex which means every
single notification had to take the mutex.

As can be seen by the diff of this commit, this approach is not only
more performant, it's also less code.
@davecgh davecgh force-pushed the rpcserver_websocket_internal_quit_chan branch from 49b58c5 to a4e2443 Compare July 27, 2020 23:58
@davecgh davecgh merged commit a4e2443 into decred:master Jul 28, 2020
@davecgh davecgh deleted the rpcserver_websocket_internal_quit_chan branch July 28, 2020 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants