You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by di...@apache.org on 2021/01/15 09:47:57 UTC

[rocketmq-client-go] branch master updated: fix http 5xx error when update nameserver addrs

This is an automated email from the ASF dual-hosted git repository.

dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new f9005db  fix http 5xx  error when update nameserver addrs
f9005db is described below

commit f9005db44a2742184e77c90ed936365303060d5c
Author: WeizhongTu <tu...@163.com>
AuthorDate: Fri Jan 15 17:47:47 2021 +0800

    fix http 5xx  error when update nameserver addrs
    
    * Update nsresolver.go
    
    fix http 5xx srvs error
---
 primitive/nsresolver.go | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/primitive/nsresolver.go b/primitive/nsresolver.go
index d844373..4e5917c 100644
--- a/primitive/nsresolver.go
+++ b/primitive/nsresolver.go
@@ -130,11 +130,15 @@ func (h *HttpResolver) Description() string {
 
 func (h *HttpResolver) get() []string {
 	resp, err := h.cli.Get(h.domain)
-	if err != nil {
-		rlog.Error("name server http fetch failed", map[string]interface{}{
+	if err != nil || resp == nil || resp.StatusCode != 200 {
+		data := map[string]interface{}{
 			"NameServerDomain": h.domain,
 			"err":              err,
-		})
+		}
+		if resp != nil {
+			data["StatusCode"] = resp.StatusCode
+		}
+		rlog.Error("name server http fetch failed", data)
 		return nil
 	}