File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -675,6 +675,18 @@ impl Database {
675
675
} ;
676
676
use tokio:: sync:: Mutex ;
677
677
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
+
678
690
let local = db. connect ( ) ?;
679
691
680
692
if * remote_writes {
Original file line number Diff line number Diff line change @@ -473,6 +473,13 @@ impl Database {
473
473
crate :: sync:: sync_offline ( & mut sync_ctx, & conn) . await
474
474
}
475
475
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
+
476
483
pub ( crate ) fn path ( & self ) -> & str {
477
484
& self . db_path
478
485
}
You can’t perform that action at this time.
0 commit comments