优化rpc超时-使用时间轮定时器

This commit is contained in:
boyce
2020-11-02 14:50:54 +08:00
parent 59c9d20071
commit c98de9b1e9
7 changed files with 34 additions and 41 deletions

View File

@@ -1,8 +1,8 @@
package rpc
import (
"github.com/golang/protobuf/proto"
"fmt"
"github.com/golang/protobuf/proto"
"sync"
)
@@ -107,7 +107,6 @@ func (slf *PBProcessor) Unmarshal(data []byte, msg interface{}) error{
return proto.Unmarshal(data, protoMsg)
}
func (slf *PBProcessor) MakeRpcRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte,inAdditionParam interface{}) IRpcRequestData{
pPbRpcRequestData := rpcPbRequestDataPool.Get().(*PBRpcRequestData)
pPbRpcRequestData.MakeRequest(seq,serviceMethod,noReply,inParam,inAdditionParam)
@@ -124,8 +123,8 @@ func (slf *PBProcessor) ReleaseRpcRequest(rpcRequestData IRpcRequestData){
rpcPbRequestDataPool.Put(rpcRequestData)
}
func (slf *PBProcessor) ReleaseRpcRespose(rpcRequestData IRpcResponseData){
rpcPbResponseDataPool.Put(rpcRequestData)
func (slf *PBProcessor) ReleaseRpcResponse(rpcResponseData IRpcResponseData){
rpcPbResponseDataPool.Put(rpcResponseData)
}
func (slf *PBProcessor) IsParse(param interface{}) bool {
@@ -133,12 +132,10 @@ func (slf *PBProcessor) IsParse(param interface{}) bool {
return ok
}
func (slf *PBProcessor) GetProcessorType() RpcProcessorType{
return RpcProcessorPb
}
func (slf *PBRpcRequestData) IsNoReply() bool{
return slf.GetNoReply()
}