diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-09-24 11:57:32 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2021-09-24 11:57:32 +0300 |
commit | 3da740d6eeb9ac9597f461bd11c48951e2997545 (patch) | |
tree | f56a9ef1b8c8daff599688834a0764173f690e7f /cmd | |
parent | afc8e9da7531a247470b64afef92ff4836c15154 (diff) |
Wait for the first health check prior to serving in Praefect
Praefect currently is not waiting for a health check to complete
before it takes over the sockets and starts routing RPCs. This can
be a problem as the RPCs will fail due to not having any healthy nodes
available if they are served prior to performing the first check. This
commit fixes the issues by waiting for the first health check to complete
prior to serving RPCs.
Changelog: fixed
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/praefect/main.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go index ed908551c..5a6c54d0c 100644 --- a/cmd/praefect/main.go +++ b/cmd/praefect/main.go @@ -300,6 +300,10 @@ func run(cfgs []starter.Config, conf config.Config) error { }() healthChecker = hm + // Wait for the first health check to complete so the Praefect doesn't start serving RPC + // before the router is ready with the health status of the nodes. + <-hm.Updated() + elector := nodes.NewPerRepositoryElector(db) primaryGetter = elector |