-
Notifications
You must be signed in to change notification settings - Fork 22
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
Feature: Add a method that checks if database is connected or not #80
Comments
Thanks for opening! Is there any reason why would you need to know that the connection is severed if you aren't using the client? Surely, you would only need that information once you tried using the client, like in the existing solution, no? |
well i run a discord bot, and it uses surrealdb, well for some reason the database dropped the connection, its been happning for quite a while recently, and sometimes even the surrealdb it self crashes, with this connection check we can atleast either try to reconnect to database or notify the issue, and might aswell connect to a backup as for the issue with connection dropping i have asked this in surrealdb's discord and the devs has replied to it, but still its being discussed there |
Are you able to capture the logs for the database crashing? And open an issue in the surrealdb/surrealdb repo for it - the database certainly shouldn't be crashing. RE the disconnects - tcp connections can drop at any point and the only way to determine that the connection is dropped is with a timeout on receiving data. So a |
public boolean checkConnection() {
|
The implementation would be slightly different. The protocol already supports pings (and we should add that to the driver). We would then use that liveness as the value. We can certainly add this method, as I can see people wanting it even though it's not quite necessary. It would certainly help in determining if a client passed as an argument has been connected or not. So we can add this. |
it would be great if you guys add one, thanks in advance |
Is your feature request related to a problem?
if somehow the connection dropped, there is no way to check if the driver is still connected or not, and you wont notice it until the application throws a exception
Describe the solution
a easy solution would be to add a method called checkConnetion or something that refers to checking the connection, the method would be a boolean and would return true if database is connected else false
Alternative methods
Yes, for now i am using a alternative way to check if its connected or not
SurrealDB version
1.0.0
Contact Details
[email protected]
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: