0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2025-06-18 02:39:05 +00:00

create a connection only if required

to spawn a bg thread for background sync, we need a connection.
however, we are creating a connection even if no `sync_interval`
was configured.
This commit is contained in:
Avinash Sajjanshetty
2025-05-20 11:48:00 +05:30
parent 3fbc60d989
commit 50b84a17f9

@ -644,11 +644,11 @@ cfg_sync! {
}
let mut bg_abort: Option<std::sync::Arc<crate::sync::DropAbort>> = None;
let conn = db.connect()?;
let sync_ctx = db.sync_ctx.as_ref().unwrap().clone();
if let Some(sync_interval) = sync_interval {
let conn = db.connect()?;
let sync_ctx = db.sync_ctx.as_ref().unwrap().clone();
let jh = tokio::spawn(
async move {
loop {