-
Couldn't load subscription status.
- Fork 431
Closed
Description
Example
#[tokio::main]
async fn main() {
let db = Database::open_remote("https://...turso.io", "...").unwrap();
let conn = db.connect().unwrap();
// Ok
conn.query("select 0", ()).await.unwrap();
std::thread::sleep(std::time::Duration::from_secs(15));
// Err: "{\"message\":\"The stream has expired due to inactivity\",\"code\":\"STREAM_EXPIRED\"}",
conn.query("select 0", ()).await.unwrap();
}The application needs to run for a long time, but SQL queries are not called frequently. This error occurs whenever there is a period of inactivity, and it cannot be recovered from. Even if called again, the same result will be obtained.
This is quite common in Web App. What is the best approach (perhaps I missed something)?
- Should I call
db.connect()to obtain a new connection before each SQL query? - Call
pingevery few seconds to keep the connection active. - Create a libsql connection pool.
Thanks libSQL.
msyavuz
Metadata
Metadata
Assignees
Labels
No labels