nacos输出报错信息

This commit is contained in:
Liujian
2023-12-15 11:10:58 +08:00
parent 475bb54d7b
commit f79234d080
3 changed files with 9 additions and 5 deletions

View File

@@ -103,7 +103,7 @@ func (n *executor) Start() error {
for _, serviceName := range keys {
res, err := n.client.GetNodeList(serviceName)
if err != nil {
log.Warnf("executor %s:%w for service %s", n.Name(), discovery.ErrDiscoveryDown, serviceName)
log.Warnf("executor %s:%v for service %s,err:%v", n.Name(), discovery.ErrDiscoveryDown, serviceName, err)
}
//更新目标服务的节点列表
n.services.Set(serviceName, res)

View File

@@ -12,7 +12,7 @@ import (
)
const (
maxBufSize = 32
maxBufSize = 4 * 1024 * 1024 // 4M
)
type Writer struct {
@@ -26,6 +26,7 @@ type Writer struct {
//multiBodySize int64
//multiBodies []multiBody
bodyChan chan []byte
bodySize int
poolChan chan *producerPool
}
@@ -141,14 +142,15 @@ func (n *Writer) doLoop() {
}
buf = append(buf, body)
n.bodySize += len(body)
if pool == nil {
timer.Reset(500 * time.Millisecond)
continue
}
if len(buf) >= maxBufSize {
if n.bodySize >= maxBufSize {
tmp := buf
buf = buf[:0]
n.bodySize = 0
err := pool.Publish(n.topic, tmp)
if err != nil {
log.Error("nsq publish error: ", err.Error())

View File

@@ -13,7 +13,9 @@ func newProxy() *_Proxy {
}
func (p *_Proxy) Set(values []interface{}) {
p.pointer.Store(&values)
tmp := make([]interface{}, 0, len(values))
tmp = append(tmp, values...)
p.pointer.Store(&tmp)
}
func (p *_Proxy) List() []interface{} {