优化RPC实例化的逻辑
This commit is contained in:
parent
f6ef545b65
commit
3bb8dc0660
10
rpc.go
10
rpc.go
@ -13,17 +13,23 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Request 请求实例
|
||||||
|
Request *request
|
||||||
|
)
|
||||||
|
|
||||||
// InitRPC 初始化RPC服务
|
// InitRPC 初始化RPC服务
|
||||||
//
|
//
|
||||||
// Author : go_developer@163.com<白茶清欢>
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
//
|
//
|
||||||
// Date : 15:23 2022/6/29
|
// Date : 15:23 2022/6/29
|
||||||
func InitRPC(serviceTable map[string]Service, loggerInstance *zap.Logger) *request {
|
func InitRPC(serviceTable map[string]Service, loggerInstance *zap.Logger) error {
|
||||||
return &request{
|
Request = &request{
|
||||||
logger: loggerInstance,
|
logger: loggerInstance,
|
||||||
serviceTable: serviceTable,
|
serviceTable: serviceTable,
|
||||||
lock: &sync.RWMutex{},
|
lock: &sync.RWMutex{},
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type request struct {
|
type request struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user