-
Notifications
You must be signed in to change notification settings - Fork 22
multi: server connection status #53
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
Conversation
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.
Nice, changes look good to me 🎉
Only two questions around naming and test coverage.
mailbox/client_conn.go
Outdated
ConnStatusNotConnected ConnStatus = "Not Connected" | ||
// ClientConnStatusNotConnected means that the client is not connected | ||
// at all. This is likely due to the mailbox server being down. | ||
ClientConnStatusNotConnected ClientConnStatus = "Not Connected" |
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.
To make these constants a bit less clunky, should we just use ClientNotConnected
, ClientSessionNotFound
? Or ClientStatusNotConnected
, ClientStatusSessionNotFound
?
mailbox/server_conn.go
Outdated
// ServerConnStatusNotConnected means that the server is currently not | ||
// connected to a mailbox. This is either because the session is | ||
// restarting or because the mailbox server is down. | ||
ServerConnStatusNotConnected ServerConnStatus = 0 |
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.
Same here, drop both ConnStatus
or just Conn
in the constant names since it's probably quite obviously a connection?
itest/server_harness.go
Outdated
@@ -74,7 +74,7 @@ func (s *serverHarness) start() error { | |||
) | |||
|
|||
mailboxServer, err := mailbox.NewServer( | |||
s.serverHost, connData, grpc.WithTransportCredentials( | |||
s.serverHost, connData, nil, grpc.WithTransportCredentials( |
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.
Can we add a check to some of our LNC itests that cover these new status callbacks?
Rename the ConnStatus type to ClientConnStatus so that we can add a Server specific Connection status type in a future commit and not confuse the two.
In this commit, the ServerConnStatus type is added. It allows a caller to extract the connection status of the server.
c0c62ef
to
1c03f18
Compare
thanks @guggero :) updated the names and added a new commit testing both the server and client status in the itests :) |
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.
Very nice, LGTM 💯
// ConnStatus is a description of the connection status of the client. | ||
type ConnStatus string | ||
// ClientStatus is a description of the connection status of the client. | ||
type ClientStatus string |
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.
👍
@@ -119,3 +161,20 @@ func testLargeResponse(t *harnessTest) { | |||
require.NoError(t.t, err) | |||
require.Equal(t.t, len(req)*10, len(resp.Resp)) | |||
} | |||
|
|||
func assertServerStatus(t *harnessTest, status mailbox.ServerStatus) { |
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.
Nice 😎
Add server connection status info so that a caller of the Server can get informed about changes in the Server's connection. The 3 statuses differ from the Client connection statuses. They are as follows:
ServerConnStatusNotConnected
: the server is not connected to the mailbox. This means it is either the mailbox is down or that the server is busy re-connecting to it.ServerConnStatusInUse
: A client is currently connected to the serverServerConnStatusIdle
: the server is connected to the mailbox and ready to accept a connection but there is no client currently connected.