feat: 设置rpc timeout
This commit is contained in:
parent
76f7b9e15c
commit
9c125f5562
|
|
@ -5,6 +5,7 @@ Cache:
|
|||
- Host: 47.97.27.195:6379
|
||||
Pass: lansexiongdi@666
|
||||
Nacos:
|
||||
Timeout: 5000
|
||||
Endpoints:
|
||||
- 120.55.12.245:10001
|
||||
Sys:
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ type Rpc struct {
|
|||
}
|
||||
|
||||
type Nacos struct {
|
||||
Timeout int64
|
||||
Endpoints []string
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,13 @@ type ServiceContext struct {
|
|||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
var timeOut int64 = 2000
|
||||
if c.Nacos.Timeout > 2000 {
|
||||
timeOut = c.Nacos.Timeout
|
||||
}
|
||||
client := transferClient.NewTransfer(zrpc.MustNewClient(zrpc.RpcClientConf{
|
||||
Endpoints: c.Nacos.Endpoints,
|
||||
Timeout: timeOut,
|
||||
}))
|
||||
|
||||
sqlConn := sqlx.NewMysql(c.DB.Master.DataSource)
|
||||
|
|
|
|||
Loading…
Reference in New Issue