代码规范过滤,移除冗余代码,替换掉不推荐的包

This commit is contained in:
孟帅
2023-05-30 12:09:40 +08:00
parent c8a808fcfd
commit b2ef3487d3
74 changed files with 564 additions and 741 deletions

View File

@@ -96,14 +96,12 @@ func NewClient(config *ClientConfig) (client *Client, err error) {
if config.ConnectInterval <= 0 {
client.connectInterval = 5 * time.Second
//client.Logger.Debugf(client.Ctx, "invalid connectInterval, reset to %v", client.connectInterval)
} else {
client.connectInterval = config.ConnectInterval
}
if config.Timeout <= 0 {
client.timeout = 10 * time.Second
//client.Logger.Debugf(client.Ctx, "invalid timeout, reset to %v", client.timeout)
} else {
client.timeout = config.Timeout
}
@@ -204,7 +202,7 @@ reconnect:
client.Lock()
if client.closeFlag {
client.Unlock()
conn.Close()
_ = conn.Close()
client.Logger.Debugf(client.Ctx, "client connect but closeFlag is true")
return
}
@@ -226,7 +224,7 @@ func (client *Client) read() {
client.Close()
client.Logger.Debugf(client.Ctx, "client are about to be reconnected..")
time.Sleep(client.connectInterval)
client.Start()
_ = client.Start()
}()
for {
@@ -383,6 +381,6 @@ func (client *Client) RpcRequest(ctx context.Context, data interface{}) (res int
}
return client.rpc.Request(key, func() {
client.Write(data)
_ = client.Write(data)
})
}