From 85ae4aa988e4c5a99865ebb56d84d954ba8c0ad5 Mon Sep 17 00:00:00 2001 From: whalecold Date: Wed, 1 Nov 2023 14:36:19 +0800 Subject: [PATCH] ignore the GetConfig error and add comments --- nacos/nacos.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nacos/nacos.go b/nacos/nacos.go index 29cbb20..437f8f3 100644 --- a/nacos/nacos.go +++ b/nacos/nacos.go @@ -251,6 +251,7 @@ func (c *client) listenConfig(param vo.ConfigParam, uniqueID int64) { Type: param.Type, OnChange: c.onChange, }) + // Performs only local connection and fails only when the input params are invalid if err != nil { panic(err) } @@ -270,7 +271,9 @@ func (c *client) RegisterConfigCallback(param vo.ConfigParam, data, err := c.ncli.GetConfig(param) // the nacos client has handled the not exist error. if err != nil { - panic(err) + // If the initial connection fails and the reconnection is successful, the callback handler can also be invoked. + // Ignore the error here and print the error info. + klog.Errorf("get config %v from nacos failed %v", param, err) } callback(data, c.parser)