diff --git a/include/haproxy/clock.h b/include/haproxy/clock.h index 11eae4f6a..8ce41e79e 100644 --- a/include/haproxy/clock.h +++ b/include/haproxy/clock.h @@ -26,6 +26,7 @@ #include extern struct timeval start_date; /* the process's start date in wall-clock time */ +extern struct timeval ready_date; /* date when the process was considered ready */ extern ullong start_time_ns; /* the process's start date in internal monotonic time (ns) */ extern volatile ullong global_now_ns; /* common monotonic date between all threads, in ns (wraps every 585 yr) */ diff --git a/src/cfgparse.c b/src/cfgparse.c index 328836af5..84c8cfa0c 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2771,9 +2771,6 @@ int check_config_validity() * Now, check for the integrity of all that we have collected. */ - /* will be needed further to delay some tasks */ - clock_update_date(0,1); - if (!global.tune.max_http_hdr) global.tune.max_http_hdr = MAX_HTTP_HDR; diff --git a/src/clock.c b/src/clock.c index 1b180e35b..7cf71607f 100644 --- a/src/clock.c +++ b/src/clock.c @@ -27,6 +27,7 @@ #include struct timeval start_date; /* the process's start date in wall-clock time */ +struct timeval ready_date; /* date when the process was considered ready */ ullong start_time_ns; /* the process's start date in internal monotonic time (ns) */ volatile ullong global_now_ns; /* common monotonic date between all threads, in ns (wraps every 585 yr) */ volatile uint global_now_ms; /* common monotonic date in milliseconds (may wrap) */ diff --git a/src/haproxy.c b/src/haproxy.c index 2bd42a95f..35aac95a0 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2247,8 +2247,19 @@ static void init(int argc, char **argv) exit(1); } + /* update the ready date that will be used to count the startup time + * during config checks (e.g. to schedule certain tasks if needed) + */ + clock_update_date(0, 1); + ready_date = date; + /* Note: global.nbthread will be initialized as part of this call */ err_code |= check_config_validity(); + + /* update the ready date to also account for the check time */ + clock_update_date(0, 1); + ready_date = date; + for (px = proxies_list; px; px = px->next) { struct server *srv; struct post_proxy_check_fct *ppcf; @@ -3508,6 +3519,10 @@ int main(int argc, char **argv) global.maxsock); } + /* update the ready date a last time to also account for final setup time */ + clock_update_date(0, 1); + ready_date = date; + if (global.mode & (MODE_DAEMON | MODE_MWORKER | MODE_MWORKER_WAIT)) { int ret = 0; int in_parent = 0;