neo4j / cypher-language-support

Neo4j's Cypher Language support
https://neo4j.github.io/cypher-language-support/
Apache License 2.0
31 stars 5 forks source link

Prototyping connection state #225

Closed daveajrussell closed 2 months ago

daveajrussell commented 3 months ago

This PR prototypes the concept of connection state.

I am introducing an `EventEmitter to schema poller class that consumers may subscribe to to be notified of connection events. Currently there are 2.. Connected and Reconnecting.. Connected is fired when a driver is initialized and passes auth/connectivity checks. Reconnecting is fired when a driver fails to pass auth and connectivity checks. I've gone with Reconnecting since the schema poller will retry every 30 seconds until it succeeds or the driver is closed.

In the extension UI, when you connect to a connection you are first presented with a "Connecting" state.. the label next to the connection will briefly read connecting... until the Connected event fires and we can update state, at which point we switch the label to connected and show a success info message. For connections that are unhealthy we will show a reconnecting... label and an accompanying error message.

This state will automatically update itself when the schema next polls.. i.e. if a connection becomes unhealthy, the UI will receive an update.

This approach introduces a fair amount of complexity, the flow state of the application becomes harder to follow and it becomes harder to test e2e.

changeset-bot[bot] commented 3 months ago

⚠️ No Changeset found

Latest commit: d5003693520f0ae7929fb22aaca879f17d043d88

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

daveajrussell commented 2 months ago

[VSCode Extension] Synchronicity between DBMS connection and extension