Skip to content

Commit 70c9bbc

Browse files
committed
libsql: Return error if boostrap fails on database open
If boostrap fails in database open, we need to return an error; otherwise we'll have the local database in inconsistent state.
1 parent 064b794 commit 70c9bbc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

libsql/src/database.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -691,17 +691,16 @@ impl Database {
691691
};
692692
use tokio::sync::Mutex;
693693

694-
let _ = tokio::task::block_in_place(move || {
694+
tokio::task::block_in_place(move || {
695695
let rt = tokio::runtime::Builder::new_current_thread()
696696
.enable_all()
697697
.build()
698698
.unwrap();
699699
rt.block_on(async {
700-
// we will ignore if any errors occurred during the bootstrapping the db,
701-
// because the client could be offline when trying to connect.
702-
let _ = db.bootstrap_db().await;
700+
db.bootstrap_db().await?;
701+
Ok::<(), crate::Error>(())
703702
})
704-
});
703+
})?;
705704

706705
let local = db.connect()?;
707706

0 commit comments

Comments
 (0)