Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions libsql/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,17 +682,20 @@ impl Database {
};
use tokio::sync::Mutex;

let _ = tokio::task::block_in_place(move || {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap();
rt.block_on(async {
if let Some(sync_ctx) = &db.sync_ctx {
let sync_ctx_clone = sync_ctx.clone();
std::thread::spawn(move || {
let rt = tokio::runtime::Runtime::new().unwrap();
// we will ignore if any errors occurred during the bootstrapping the db,
// because the client could be offline when trying to connect.
let _ = db.bootstrap_db().await;
rt.block_on(async {
let mut locked_ctx = sync_ctx_clone.lock().await;
let _ = crate::sync::bootstrap_db(&mut locked_ctx).await;
});
})
});
.join()
.expect("thread panicked while bootstrapping the db");
}

let local = db.connect()?;

Expand Down
Loading