Skip to content

Commit 50b84a1

Browse files
committed
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.
1 parent 3fbc60d commit 50b84a1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

libsql/src/database/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,11 @@ cfg_sync! {
644644
}
645645

646646
let mut bg_abort: Option<std::sync::Arc<crate::sync::DropAbort>> = None;
647-
let conn = db.connect()?;
648-
649-
let sync_ctx = db.sync_ctx.as_ref().unwrap().clone();
650647

651648
if let Some(sync_interval) = sync_interval {
649+
let conn = db.connect()?;
650+
let sync_ctx = db.sync_ctx.as_ref().unwrap().clone();
651+
652652
let jh = tokio::spawn(
653653
async move {
654654
loop {

0 commit comments

Comments
 (0)