Feature: Timeout for client if server is offline #3229
Labels
feature
New feature or request
topic:rust
This is related to the Rust embedded library
triage
This issue is new
Is your feature request related to a problem?
I am hosting the surreal client and server on separate systems. If the client successfully connect to the server but then I close the server and run a query on the client, it will keep awaiting until I turn the server back on.
For my usecase this is relevant because I am using surrealdb for my discord bot and some commands will read/write to the database. If the database is down then the commands that uses the database will stop responding and once it's up again all the queries will go through and it'd be a bit too late to respond to the users command and they'd also be clueless that the configuration they did a while ago finally went through.
Describe the solution
A solution could be to instead of waiting for the server to come online, return an error saying the server is offline. I also understand that the current way of doing it also has some pros. So this could maybe be behind a feature flag, or a method on the client to specify if it should wait for a response or not.
Alternative methods
I've tried using tokio::time::timeout which will return an error after a certain amount of time. This works but the problem is that it doesn't stop the query and the query will still go through once the server is on again.
SurrealDB version
1.0.2 for linux on x86_64
Contact Details
No response
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: