File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,9 @@ mod setup_guard;
6
6
mod subcommand;
7
7
8
8
use ckb_app_config:: { cli, ExitCode , Setup } ;
9
- use ckb_async_runtime:: new_global_runtime;
9
+ use ckb_async_runtime:: { new_global_runtime, tokio :: time :: timeout } ;
10
10
use ckb_build_info:: Version ;
11
11
use ckb_logger:: info;
12
- use ckb_network:: tokio;
13
12
use helper:: raise_fd_limit;
14
13
use setup_guard:: SetupGuard ;
15
14
@@ -79,13 +78,14 @@ pub fn run_app(version: Version) -> Result<(), ExitCode> {
79
78
if matches ! ( cmd, cli:: CMD_RUN ) {
80
79
handle. drop_guard ( ) ;
81
80
82
- tokio :: task :: block_in_place ( || {
81
+ handle . block_on ( async move {
83
82
info ! ( "waiting all tokio tasks exit..." ) ;
84
- handle_stop_rx. blocking_recv ( ) ;
85
- info ! ( "all tokio tasks and threads have exited, ckb shutdown" ) ;
83
+ match timeout ( std:: time:: Duration :: from_secs ( 20 ) , handle_stop_rx. recv ( ) ) . await {
84
+ Ok ( _) => info ! ( "all tokio tasks and threads have exited, ckb shutdown" ) ,
85
+ Err ( _) => info ! ( "wait tokio tasks exit time out, ckb shutdown" ) ,
86
+ }
86
87
} ) ;
87
88
}
88
-
89
89
ret
90
90
}
91
91
You can’t perform that action at this time.
0 commit comments