File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -33,18 +33,16 @@ async fn main() -> Result<()> {
33
33
let token = CancellationToken :: new ( ) ;
34
34
let cancellation_token = token. clone ( ) ;
35
35
tokio:: spawn ( async move {
36
- if let Some ( timeout_str) = env:: var ( "DKN_EXIT_TIMEOUT" ) . ok ( ) {
36
+ if let Ok ( timeout_str) = env:: var ( "DKN_EXIT_TIMEOUT" ) {
37
37
let duration_secs = timeout_str. parse ( ) . unwrap_or ( 120 ) ;
38
38
log:: warn!( "Waiting for {} seconds before exiting." , duration_secs) ;
39
39
tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( duration_secs) ) . await ;
40
40
cancellation_token. cancel ( ) ;
41
- } else {
42
- if let Err ( err) = wait_for_termination ( cancellation_token. clone ( ) ) . await {
43
- log:: error!( "Error waiting for termination: {:?}" , err) ;
44
- log:: error!( "Cancelling due to unexpected error." ) ;
45
- cancellation_token. cancel ( ) ;
46
- } ;
47
- }
41
+ } else if let Err ( err) = wait_for_termination ( cancellation_token. clone ( ) ) . await {
42
+ log:: error!( "Error waiting for termination: {:?}" , err) ;
43
+ log:: error!( "Cancelling due to unexpected error." ) ;
44
+ cancellation_token. cancel ( ) ;
45
+ } ;
48
46
} ) ;
49
47
50
48
// create configurations & check required services & address in use
You can’t perform that action at this time.
0 commit comments