-
Notifications
You must be signed in to change notification settings - Fork 177
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
Websocket shutdown logic #2277
base: main
Are you sure you want to change the base?
Websocket shutdown logic #2277
Conversation
5a713f0
to
bf93293
Compare
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.
👍 Just small concerns
case <-ctx.Done(): | ||
// in case websocket connection is closed and server is not in shutdown mode | ||
// we need to release this goroutine from waiting | ||
} |
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.
World you mind to add return
here to make it more clear we intend to exit the goroutine?
For me it'd more readable 🤔
@@ -20,7 +20,7 @@ func testConnection(t *testing.T, ctx context.Context, method jsonrpc.Method, li | |||
require.NoError(t, rpc.RegisterMethods(method)) | |||
|
|||
// Server | |||
srv := httptest.NewServer(jsonrpc.NewWebsocket(rpc, utils.NewNopZapLogger())) | |||
srv := httptest.NewServer(jsonrpc.NewWebsocket(rpc, nil, utils.NewNopZapLogger())) |
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.
According to this article nil
channel will block indefinitely, which is I think counter-intuitive.
Maybe it's worth to add a comment that it will block?
@@ -347,7 +347,7 @@ func TestMultipleSubscribeNewHeadsAndUnsubscribe(t *testing.T) { | |||
Params: []jsonrpc.Parameter{{Name: "id"}}, | |||
Handler: handler.Unsubscribe, | |||
})) | |||
ws := jsonrpc.NewWebsocket(server, log) | |||
ws := jsonrpc.NewWebsocket(server, nil, log) |
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.
Also comment about the nil
-channel behaviour? (see prev comment)
c218d68
to
301962d
Compare
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.
LGTM. Please point the branch to main.
No description provided.