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:
@ -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 {
|
||||
|
Reference in New Issue
Block a user