@@ -136,7 +136,7 @@ impl ServeCommand {
136
136
println ! ( "Press Ctrl+C to stop" ) ;
137
137
138
138
// Create the stop signal channel
139
- let ( stop_tx, _stop_rx ) = dependencies_builder
139
+ let ( stop_tx, stop_rx ) = dependencies_builder
140
140
. get_stop_signal_channel ( )
141
141
. await
142
142
. with_context ( || "Dependencies Builder can not create stop signal channel" ) ?;
@@ -175,20 +175,20 @@ impl ServeCommand {
175
175
let preload_task =
176
176
tokio:: spawn ( async move { cardano_transactions_preloader. preload ( ) . await } ) ;
177
177
178
- // sStart the HTTP server
179
- let ( shutdown_tx, shutdown_rx) = oneshot:: channel ( ) ;
178
+ // Start the HTTP server
180
179
let routes = dependencies_builder
181
180
. create_http_routes ( )
182
181
. await
183
182
. with_context ( || "Dependencies Builder can not create http routes" ) ?;
183
+ let mut stop_rx_clone = stop_rx. clone ( ) ;
184
184
join_set. spawn ( async move {
185
185
let ( _, server) = warp:: serve ( routes) . bind_with_graceful_shutdown (
186
186
(
187
187
config. server_ip . clone ( ) . parse :: < IpAddr > ( ) . unwrap ( ) ,
188
188
config. server_port ,
189
189
) ,
190
- async {
191
- shutdown_rx . await . ok ( ) ;
190
+ async move {
191
+ stop_rx_clone . changed ( ) . await . ok ( ) ;
192
192
} ,
193
193
) ;
194
194
server. await ;
@@ -286,9 +286,8 @@ impl ServeCommand {
286
286
287
287
// Stop servers
288
288
join_set. shutdown ( ) . await ;
289
- let _ = shutdown_tx. send ( ( ) ) ;
290
289
291
- // Send the stop signal to all services
290
+ // Send the stop signal
292
291
let _ = stop_tx. send ( ( ) ) ;
293
292
294
293
if !preload_task. is_finished ( ) {
0 commit comments