@@ -555,10 +555,18 @@ impl Default for DistConfig {
555555pub struct FileConfig {
556556 pub cache : CacheConfigs ,
557557 pub dist : DistConfig ,
558+ // pub timing: ServerTimingConfig,
558559 pub server_startup_timeout_ms : Option < u64 > ,
560+ pub server_shutdown_timeout_ms : Option < u64 > ,
559561 pub port : Option < u16 > ,
560562}
561563
564+ // #[derive(Debug, Default, Serialize, Deserialize, Eq, PartialEq)]
565+ // pub struct ServerTimingConfig {
566+ // pub server_startup_timeout_ms: Option<u64>,
567+ // pub server_shutdown_timeout_ms: Option<u64>,
568+ // }
569+
562570// If the file doesn't exist or we can't read it, log the issue and proceed. If the
563571// config exists but doesn't parse then something is wrong - return an error.
564572pub fn try_read_config_file < T : DeserializeOwned > ( path : & Path ) -> Result < Option < T > > {
@@ -946,10 +954,16 @@ pub struct Config {
946954 pub cache : Option < CacheType > ,
947955 pub fallback_cache : DiskCacheConfig ,
948956 pub dist : DistConfig ,
949- pub server_startup_timeout : Option < std :: time :: Duration > ,
957+ pub server_timing : ServerTiming ,
950958 pub port : Option < u16 > ,
951959}
952960
961+ #[ derive( Debug , Default , PartialEq , Eq ) ]
962+ pub struct ServerTiming {
963+ pub startup_timeout : Option < std:: time:: Duration > ,
964+ pub shutdown_timeout : Option < std:: time:: Duration > ,
965+ }
966+
953967impl Config {
954968 pub fn load ( ) -> Result < Self > {
955969 let env_conf = config_from_env ( ) ?;
@@ -969,12 +983,20 @@ impl Config {
969983 cache,
970984 dist,
971985 server_startup_timeout_ms,
986+ server_shutdown_timeout_ms,
972987 port,
973988 } = file_conf;
974989 conf_caches. merge ( cache) ;
975990
976991 let server_startup_timeout =
977992 server_startup_timeout_ms. map ( std:: time:: Duration :: from_millis) ;
993+ let server_shutdown_timeout =
994+ server_shutdown_timeout_ms. map ( std:: time:: Duration :: from_millis) ;
995+ let server_timing = ServerTiming {
996+ startup_timeout : server_startup_timeout,
997+ shutdown_timeout : server_shutdown_timeout,
998+ } ;
999+
9781000
9791001 let EnvConfig { cache } = env_conf;
9801002 conf_caches. merge ( cache) ;
@@ -984,7 +1006,7 @@ impl Config {
9841006 cache : caches,
9851007 fallback_cache,
9861008 dist,
987- server_startup_timeout ,
1009+ server_timing ,
9881010 port,
9891011 }
9901012 }
@@ -1285,6 +1307,7 @@ fn config_overrides() {
12851307 } ,
12861308 dist : Default :: default ( ) ,
12871309 server_startup_timeout_ms : None ,
1310+ server_shutdown_timeout_ms : None ,
12881311 port : None ,
12891312 } ;
12901313
@@ -1307,7 +1330,7 @@ fn config_overrides() {
13071330 rw_mode: CacheModeConfig :: ReadWrite ,
13081331 } ,
13091332 dist: Default :: default ( ) ,
1310- server_startup_timeout : None ,
1333+ server_timing : Default :: default ( ) ,
13111334 port: None ,
13121335 }
13131336 ) ;
@@ -1583,7 +1606,8 @@ no_credentials = true
15831606 toolchain_cache_size: 5368709120 ,
15841607 rewrite_includes_only: false ,
15851608 } ,
1586- server_startup_timeout_ms: Some ( 10000 ) ,
1609+ server_startup_timeout_ms: Some ( 10_000 ) ,
1610+ server_shutdown_timeout_ms: None ,
15871611 port: None ,
15881612 }
15891613 )
@@ -1600,6 +1624,7 @@ fn test_port_config() {
16001624 cache: Default :: default ( ) ,
16011625 dist: Default :: default ( ) ,
16021626 server_startup_timeout_ms: None ,
1627+ server_shutdown_timeout_ms: None ,
16031628 port: Some ( 8080 ) ,
16041629 }
16051630 )
0 commit comments