优化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"
|
||||
)
|
||||
|
||||
var (
|
||||
// Request 请求实例
|
||||
Request *request
|
||||
)
|
||||
|
||||
// InitRPC 初始化RPC服务
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:23 2022/6/29
|
||||
func InitRPC(serviceTable map[string]Service, loggerInstance *zap.Logger) *request {
|
||||
return &request{
|
||||
func InitRPC(serviceTable map[string]Service, loggerInstance *zap.Logger) error {
|
||||
Request = &request{
|
||||
logger: loggerInstance,
|
||||
serviceTable: serviceTable,
|
||||
lock: &sync.RWMutex{},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type request struct {
|
||||
|
Loading…
Reference in New Issue
Block a user