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

Misc improvements #344

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Misc improvements #344

wants to merge 8 commits into from

Conversation

macjuul
Copy link
Contributor

@macjuul macjuul commented Sep 25, 2024

  • Refactored file names and imports

  • Enforce file name format

  • Initial work on reconnect support

  • I have read the Contributing Guidelines

@ntorrey
Copy link

ntorrey commented Sep 25, 2024

Yay for reconnect support! 🎉

@phisch
Copy link

phisch commented Oct 21, 2024

@macjuul We just ran into an issue of our backend losing the connection to the database, and the backend had no way to even tell us about that. Anything using queries was just stuck indefinitely. We'd be super stoked about reconnect support. But is there anything we can do in the meantime until this gets merged? Even just being able to have a timeout that would let us know the connection is lost would be a big improvement.

@macjuul
Copy link
Contributor Author

macjuul commented Oct 21, 2024

@macjuul We just ran into an issue of our backend losing the connection to the database, and the backend had no way to even tell us about that. Anything using queries was just stuck indefinitely. We'd be super stoked about reconnect support. But is there anything we can do in the meantime until this gets merged? Even just being able to have a timeout that would let us know the connection is lost would be a big improvement.

We are still debating on the internal implementation of a reconnect system, however in Surrealist I implemented this manually by subscribing to disconnect events and instantiating a new connection. Until official support is available this is likely the best approach

@phisch
Copy link

phisch commented Oct 21, 2024

@macjuul Thanks for letting me know. But that would only work using rust, right? I don't see a way to subscribe to events in the TS SDK. (Hopefully I'm just blind)

Edit: I just saw there is .emitter on the connection. Not documented, but it looks like that would do it.

Edit 2: Yep, this seems to be that:

connection.emitter.subscribe("disconnected", async () => {
    // whatever
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants