@@ -10,7 +10,7 @@ use shvclient::clientapi::{CallRpcMethodErrorKind, RpcCall, RpcCallDirExists, Rp
1010use shvclient:: clientnode:: { METH_DIR , SIG_CHNG } ;
1111use shvclient:: { ClientCommandSender , ClientEvent , ClientEventsReceiver } ;
1212use shvproto:: { DateTime , RpcValue } ;
13- use shvrpc:: rpcmessage:: RpcError ;
13+ use shvrpc:: rpcmessage:: { RpcError , RpcErrorCode } ;
1414use shvrpc:: typeinfo:: TypeInfo ;
1515use shvrpc:: util:: find_longest_path_prefix;
1616use shvrpc:: { join_path, RpcMessageMetaTags } ;
@@ -552,6 +552,11 @@ async fn reload_sites(
552552 . acquire ( )
553553 . await
554554 . unwrap_or_else ( |e| panic ! ( "Cannot acquire semaphore: {e}" ) ) ;
555+
556+ if app_state. app_closing . load ( std:: sync:: atomic:: Ordering :: Relaxed ) {
557+ return ( site_path, type_info, Err ( RpcError :: new ( RpcErrorCode :: InternalError , "App is closing" ) ) ) ;
558+ }
559+
555560 let log = getlog_handler ( & site_path, & params, app_state) . await ;
556561 ( site_path, type_info, log)
557562 }
@@ -561,7 +566,9 @@ async fn reload_sites(
561566 match result {
562567 Ok ( log) => Some ( ( site_path, type_info, log) ) ,
563568 Err ( err) => {
564- log:: error!( "couldn't init alarms: getlog failed: {err}" ) ;
569+ if !app_state. app_closing . load ( std:: sync:: atomic:: Ordering :: Relaxed ) {
570+ log:: error!( "couldn't init alarms: getlog failed: {err}" ) ;
571+ }
565572 None
566573 }
567574 }
0 commit comments