File tree Expand file tree Collapse file tree 1 file changed +18
-14
lines changed Expand file tree Collapse file tree 1 file changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -210,14 +210,16 @@ impl HttpTrigger {
210210
211211 let shutdown_signal = on_ctrl_c ( ) ?;
212212
213- Server :: bind ( & addr)
214- . serve ( mk_svc)
215- . with_graceful_shutdown ( async {
216- shutdown_signal. await . ok ( ) ;
217- } )
218- . await ?;
213+ let server = Server :: bind ( & addr) . serve ( mk_svc) ;
219214
220- log:: debug!( "User requested shutdown: exiting" ) ;
215+ tokio:: select! {
216+ _ = server => {
217+ log:: debug!( "Server shut down: exiting" ) ;
218+ } ,
219+ _ = shutdown_signal => {
220+ log:: debug!( "User requested shutdown: exiting" ) ;
221+ } ,
222+ } ;
221223
222224 Ok ( ( ) )
223225 }
@@ -274,14 +276,16 @@ impl HttpTrigger {
274276
275277 let shutdown_signal = on_ctrl_c ( ) ?;
276278
277- Server :: builder ( incoming)
278- . serve ( mk_svc)
279- . with_graceful_shutdown ( async {
280- shutdown_signal. await . ok ( ) ;
281- } )
282- . await ?;
279+ let server = Server :: builder ( incoming) . serve ( mk_svc) ;
283280
284- log:: debug!( "User requested shutdown: exiting" ) ;
281+ tokio:: select! {
282+ _ = server => {
283+ log:: debug!( "Server shut down: exiting" ) ;
284+ } ,
285+ _ = shutdown_signal => {
286+ log:: debug!( "User requested shutdown: exiting" ) ;
287+ } ,
288+ } ;
285289
286290 Ok ( ( ) )
287291 }
You can’t perform that action at this time.
0 commit comments