File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 bootstrapping the db,
685+ // because the client could be offline when trying to connect.
686+ let _ = db. bootstrap_db ( ) . await ;
687+ } )
688+ } ) ;
689+
678690 let local = db. connect ( ) ?;
679691
680692 if * remote_writes {
Original file line number Diff line number Diff line change @@ -473,6 +473,13 @@ impl Database {
473473 crate :: sync:: sync_offline ( & mut sync_ctx, & conn) . await
474474 }
475475
476+ #[ cfg( feature = "sync" ) ]
477+ /// Brings the .db file from server, if required.
478+ pub async fn bootstrap_db ( & self ) -> Result < ( ) > {
479+ let mut sync_ctx = self . sync_ctx . as_ref ( ) . unwrap ( ) . lock ( ) . await ;
480+ crate :: sync:: bootstrap_db ( & mut sync_ctx) . await
481+ }
482+
476483 pub ( crate ) fn path ( & self ) -> & str {
477484 & self . db_path
478485 }
You can’t perform that action at this time.
0 commit comments