File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -683,35 +683,16 @@ impl Database {
683683 use tokio:: sync:: Mutex ;
684684
685685 if let Some ( sync_ctx) = & db. sync_ctx {
686- let sync_ctx = sync_ctx. clone ( ) ;
687- // we will ignore if any errors occurred during the bootstrapping the db,
688- // because the client could be offline when trying to connect.
689- match tokio:: runtime:: Handle :: try_current ( ) {
690- Ok ( _) => {
691- std:: thread:: spawn ( move || {
692- let rt = tokio:: runtime:: Builder :: new_current_thread ( )
693- . enable_all ( )
694- . build ( )
695- . unwrap ( ) ;
696- rt. block_on ( async {
697- let mut locked_ctx = sync_ctx. lock ( ) . await ;
698- let _ = crate :: sync:: bootstrap_db ( & mut locked_ctx) . await ;
699- } ) ;
700- } )
701- . join ( )
702- . expect ( "bootstrap thread panicked" ) ;
703- }
704- Err ( _) => {
705- let rt = tokio:: runtime:: Builder :: new_current_thread ( )
706- . enable_all ( )
707- . build ( )
708- . unwrap ( ) ;
709- rt. block_on ( async {
710- let mut locked_ctx = sync_ctx. lock ( ) . await ;
711- let _ = crate :: sync:: bootstrap_db ( & mut locked_ctx) . await ;
712- } ) ;
713- }
714- }
686+ let sync_ctx_clone = sync_ctx. clone ( ) ;
687+ std:: thread:: spawn ( move || {
688+ let rt = tokio:: runtime:: Runtime :: new ( ) . unwrap ( ) ;
689+ rt. block_on ( async {
690+ let mut locked_ctx = sync_ctx_clone. lock ( ) . await ;
691+ let _ = crate :: sync:: bootstrap_db ( & mut locked_ctx) . await ;
692+ } ) ;
693+ } )
694+ . join ( )
695+ . expect ( "thread panicked while bootstrapping the db" ) ;
715696 }
716697
717698 let local = db. connect ( ) ?;
You can’t perform that action at this time.
0 commit comments