Skip to content

Commit 1731db3

Browse files
committed
Bootstrap the db on connect if required
1 parent 570bfda commit 1731db3

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

libsql/src/database.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,18 @@ impl Database {
675675
};
676676
use tokio::sync::Mutex;
677677

678+
let _ = tokio::task::block_in_place(move || {
679+
let rt = tokio::runtime::Builder::new_current_thread()
680+
.enable_all()
681+
.build()
682+
.unwrap();
683+
rt.block_on(async {
684+
// we will ignore if any errors occurred during the sync, because the client
685+
// could be offline when trying to connect.
686+
let _ = db.sync_offline().await;
687+
})
688+
});
689+
678690
let local = db.connect()?;
679691

680692
if *remote_writes {

0 commit comments

Comments
 (0)