Always OK for leader

This commit is contained in:
tidwall 2021-05-25 16:42:26 -07:00
parent 30c3e81e0d
commit 27335c37f1
1 changed files with 6 additions and 6 deletions

View File

@ -97,13 +97,13 @@ func (s *Server) cmdStats(msg *Message) (res resp.Value, err error) {
func (s *Server) cmdHealthz(msg *Message) (res resp.Value, err error) { func (s *Server) cmdHealthz(msg *Message) (res resp.Value, err error) {
start := time.Now() start := time.Now()
// if s.config.followHost() != "" { if s.config.followHost() != "" {
m := make(map[string]interface{}) m := make(map[string]interface{})
s.basicStats(m) s.basicStats(m)
if fmt.Sprintf("%v\n", m["caught_up"]) != "true" { if fmt.Sprintf("%v\n", m["caught_up"]) != "true" {
return NOMessage, errors.New("not caught up") return NOMessage, errors.New("not caught up")
}
} }
// }
switch msg.OutputType { switch msg.OutputType {
case JSON: case JSON:
res = resp.StringValue(`{"ok":true,"elapsed":"` + time.Since(start).String() + "\"}") res = resp.StringValue(`{"ok":true,"elapsed":"` + time.Since(start).String() + "\"}")