Closed 13262233692 closed 1 year ago
程序日志 写入nacos配置前 , 执行命令查看结果 total used free shared buff/cache available Mem: 4102900 731512 3006736 476 364652 3174304 Swap: 0 0 0 2023/03/22 08:18:33 nacos_client.go:64: [INFO] logDir:</tmp/nacos/log> cacheDir:</tmp/nacos/cache> nacos 创建client , 执行命令查看结果 total used free shared buff/cache available Mem: 4102900 731512 3006736 476 364652 3174304 Swap: 0 0 0 准备写入远程nacos , 执行命令查看结果 total used free shared buff/cache available Mem: 4102900 731512 3006736 476 364652 3174304 Swap: 0 0 0 Killed
push代码
func (nacosConf NacosConf) PushConfig(namepaceId,DataId,Group string,content string) error{
client,err := nacosConf.GetNacosClient(namepaceId)
defer client.CloseClient()
if err != nil {
log.Error.Printf("nacos new client failed: %v ",err)
return err
}
osFree("free","准备写入远程nacos")
_, err = client.PublishConfig(vo.ConfigParam{
DataId: DataId,
Group: Group,
Content: *content,
})
osFree("free","远程nacos配置写入成功")
if err != nil {
fmt.Printf("PublishConfig err:%+v \n", err)
log.Error.Printf("推送nacos配置失败: %v ",err)
return err
}
time.Sleep(1 * time.Second)
log.Info.Printf("推送nacos配置成功... ")
return nil
}
go-sdk 回退到2.1.3正常
2.1.3也有很多坑
容器内存4g 调用nacos-go-sdk push配置的时候(配置不超过1m) 程序退出,进程直接被oom