From 0fa51e5ba96751b9711bc5a2b8e9fdbde0238f42 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 9 Feb 2021 13:55:26 -0500 Subject: [PATCH] api: Use blocking query for health when near is set Streaming can not be used for these queries because the near query paramter indicates a specific sort of the results, and that sort requires data that is not available to the client from the streaming API. --- agent/health_endpoint.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/agent/health_endpoint.go b/agent/health_endpoint.go index b37c47e16a..0d8e2f1e89 100644 --- a/agent/health_endpoint.go +++ b/agent/health_endpoint.go @@ -219,7 +219,10 @@ func (s *HTTPHandlers) healthServiceNodes(resp http.ResponseWriter, req *http.Re return nil, nil } - useStreaming := s.agent.config.UseStreamingBackend && args.MinQueryIndex > 0 + // useStreaming when a blocking query is requested, but not when the near + // query parameter is set, because that requires data only available to the server + // to sort the results. + useStreaming := s.agent.config.UseStreamingBackend && args.MinQueryIndex > 0 && args.Source.Node == "" args.QueryOptions.UseCache = s.agent.config.HTTPUseCache && (args.QueryOptions.UseCache || useStreaming) out, md, err := s.agent.rpcClientHealth.ServiceNodes(req.Context(), args)