-
Notifications
You must be signed in to change notification settings - Fork 5
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
Migrate waitForConnectionToBeUsable() to react to pushed connection event state changes #882
Conversation
… push the connection state filtering down into a lambda passed into ConnectionStateWatcher.waitForConnectionUpdate().
…ts about connection from websocket, not polling so as to be able to react immediately.
…change_event_handling
… so that subsequent call to waitForConnectionToBeStable() won't prematurely return with old info.
@@ -1 +1 @@ | |||
v0.134.1 | |||
v0.139.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.
Need fix for ccloud connection java.time.Instant serialization-over-websocket.
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.
Overall I'm good with the changes, and mostly had minor suggestions/questions regarding logging and documentation, but the only change I think we need is to put connectionLoading.fire(id)
back since it looks like we no longer show the loading~spin
icon when a connection is in a non-stable state -- should that live inside waitForConnectionUpdate
, or in the ConnectionStateWatcher
itself?
…change_event_handling
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.
@jlrobins and I still have some lingering edge cases to hammer out in follow-on branches since this overall performance improvement floated some race conditions we previously didn't have to worry about -- future us will deal with it next week!
Summary of Changes
waitForConnectionToBeUsable()
towaitForConnectionToBeStable()
, in that it may not always return a happy connection (say, if cclioud auth is bad, or direct connection cannot connect, etc., or if it times out).waitForConnectionToBeStable()
from a polling GET loop to reacting against connection state change events pushed by sidecar over websocket.ConnectionStateWatcher
which consumes the sidecar -> workspace websocket messages describing changes to connection states, keeps track of the most recently observed connection state, and offers an API forwaitForConnectionToBeStable()
to use to pause just the right amount of time until sidecar pushes a stable-state Connection description for the connection id in question thatwaitForConnectionToBeStable()
was called about. Even works if the websocket event with the new stable state precedes the call towaitForConnectionToBeStable()
, as is the curious case with CCloud connection creation and the byzantine authentication flow, due toConnectionStateWatcher
caching the most recently received update for a connection and will return it towaitForConnectionToBeStable()
if it meets the 'stable state' criteria for the connection type (sadly complicated by how sidecar describes a ccloud connection in the progress of authorization vs a direct connection not yet verified, originally expressed in a large case statement embedded inwaitForConnectionToBeStable()
's while loop, now expressed in the functions in new moduleconnectionStatusUtils.ts
.Any additional details or context that should be provided?
ConnectionStateWatcher
, which now knows exactly what the ccloud auth status poller is interested in.Pull request checklist
Please check if your PR fulfills the following (if applicable):
Tests
Other
.vsix
file?