File tree Expand file tree Collapse file tree 1 file changed +12
-29
lines changed
Expand file tree Collapse file tree 1 file changed +12
-29
lines changed Original file line number Diff line number Diff line change @@ -683,35 +683,18 @@ 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+ // we will ignore if any errors occurred during the bootstrapping the db,
690+ // because the client could be offline when trying to connect.
691+ rt. block_on ( async {
692+ let mut locked_ctx = sync_ctx_clone. lock ( ) . await ;
693+ let _ = crate :: sync:: bootstrap_db ( & mut locked_ctx) . await ;
694+ } ) ;
695+ } )
696+ . join ( )
697+ . expect ( "thread panicked while bootstrapping the db" ) ;
715698 }
716699
717700 let local = db. connect ( ) ?;
You can’t perform that action at this time.
0 commit comments