mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-12-14 04:06:05 +08:00
代码规范过滤,移除冗余代码,替换掉不推荐的包
This commit is contained in:
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user