@@ -38,7 +38,7 @@ use std::{
38
38
sync:: { Arc , LazyLock } ,
39
39
time:: { Duration , Instant , SystemTime , UNIX_EPOCH } ,
40
40
} ;
41
- use tokio:: sync:: Mutex ;
41
+ use tokio:: { select , sync:: Mutex } ;
42
42
use tower_http:: {
43
43
cors:: { self , CorsLayer } ,
44
44
request_id:: { MakeRequestUuid , PropagateRequestIdLayer , SetRequestIdLayer } ,
@@ -71,7 +71,7 @@ pub(crate) async fn serve(config: Config) {
71
71
let factory = Factory ( Arc :: new ( config. coordinator_factory ( ) ) ) ;
72
72
73
73
let request_db = config. request_database ( ) ;
74
- let ( _db_task , db_handle) = request_db. spawn ( ) ;
74
+ let ( db_task , db_handle) = request_db. spawn ( ) ;
75
75
76
76
let root_files = static_file_service ( config. root_path ( ) , MAX_AGE_ONE_DAY ) ;
77
77
let asset_files = static_file_service ( config. asset_path ( ) , MAX_AGE_ONE_YEAR ) ;
@@ -170,9 +170,12 @@ pub(crate) async fn serve(config: Config) {
170
170
. await
171
171
. unwrap ( ) ;
172
172
173
- axum:: serve ( listener, app. into_make_service ( ) )
174
- . await
175
- . unwrap ( ) ;
173
+ let server = axum:: serve ( listener, app. into_make_service ( ) ) ;
174
+
175
+ select ! {
176
+ v = server => v. unwrap( ) ,
177
+ v = db_task => v. unwrap( ) ,
178
+ }
176
179
}
177
180
178
181
fn get_or_post < T : ' static > ( handler : impl Handler < T , ( ) > + Copy ) -> MethodRouter {
0 commit comments