File tree Expand file tree Collapse file tree 2 files changed +6
-19
lines changed
Expand file tree Collapse file tree 2 files changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ pub async fn check_shutdown_middleware(
5353 }
5454}
5555
56- pub async fn handle_signals ( shutdown_signal : Arc < Mutex < Option < oneshot:: Sender < ( ) > > > > ) {
56+ pub async fn handle_signals ( shutdown_signal : oneshot:: Sender < ( ) > ) {
5757 #[ cfg( windows) ]
5858 {
5959 tokio:: select! {
@@ -80,19 +80,10 @@ pub async fn handle_signals(shutdown_signal: Arc<Mutex<Option<oneshot::Sender<()
8080 }
8181}
8282
83- async fn shutdown ( shutdown_signal : Arc < Mutex < Option < oneshot:: Sender < ( ) > > > > ) {
84- // Set the shutdown flag to true
85- let mut shutdown_flag = SIGNAL_RECEIVED . lock ( ) . await ;
86- * shutdown_flag = true ;
87-
88- // Sync to local
89- crate :: event:: STREAM_WRITERS . unset_all ( ) ;
90-
91- // Trigger graceful shutdown
92- if let Some ( shutdown_sender) = shutdown_signal. lock ( ) . await . take ( ) {
93- let _ = shutdown_sender. send ( ( ) ) ;
94- }
83+ async fn shutdown ( shutdown_signal : oneshot:: Sender < ( ) > ) {
84+ shutdown_signal. send ( ( ) ) . unwrap ( ) ;
9585}
86+
9687pub async fn readiness ( ) -> HttpResponse {
9788 // Check the object store connection
9889 if CONFIG . storage ( ) . get_object_store ( ) . check ( ) . await . is_ok ( ) {
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ use openid::Discovered;
3838use serde:: Deserialize ;
3939use serde:: Serialize ;
4040use ssl_acceptor:: get_ssl_acceptor;
41- use tokio:: sync:: { oneshot, Mutex } ;
41+ use tokio:: sync:: oneshot;
4242use tracing:: { error, info, warn} ;
4343
4444use super :: audit;
@@ -110,14 +110,10 @@ pub trait ParseableServer {
110110
111111 // Create a channel to trigger server shutdown
112112 let ( shutdown_trigger, shutdown_rx) = oneshot:: channel :: < ( ) > ( ) ;
113- let server_shutdown_signal = Arc :: new ( Mutex :: new ( Some ( shutdown_trigger) ) ) ;
114-
115- // Clone the shutdown signal for the signal handler
116- let shutdown_signal = server_shutdown_signal. clone ( ) ;
117113
118114 // Spawn the signal handler task
119115 let signal_task = tokio:: spawn ( async move {
120- health_check:: handle_signals ( shutdown_signal ) . await ;
116+ health_check:: handle_signals ( shutdown_trigger ) . await ;
121117 println ! ( "Received shutdown signal, notifying server to shut down..." ) ;
122118 } ) ;
123119
You can’t perform that action at this time.
0 commit comments