From 5675681ab1b419f1db28568aeb502ce85cb10a67 Mon Sep 17 00:00:00 2001 From: duanhf2012 <6549168@qq.com> Date: Thu, 4 May 2023 14:21:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96concurrent=E4=B8=8Erpc?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- concurrent/dispatch.go | 2 +- rpc/rpchandler.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/concurrent/dispatch.go b/concurrent/dispatch.go index 8e6a661..64935a4 100644 --- a/concurrent/dispatch.go +++ b/concurrent/dispatch.go @@ -80,7 +80,7 @@ func (d *dispatch) run() { } func (d *dispatch) processTimer() { - if d.idle == true && d.workerNum > d.minConcurrentNum { + if d.idle == true && d.workerNum > atomic.LoadInt32(&d.minConcurrentNum) { d.processIdle() } diff --git a/rpc/rpchandler.go b/rpc/rpchandler.go index cf61d66..dbea051 100644 --- a/rpc/rpchandler.go +++ b/rpc/rpchandler.go @@ -291,14 +291,16 @@ func (handler *RpcHandler) HandlerRpcRequest(request *RpcRequest) { request.requestHandle(nil, RpcError(rErr)) return } + + requestHanle := request.requestHandle returnValues := v.method.Func.Call(paramList) errInter := returnValues[0].Interface() if errInter != nil { err = errInter.(error) } - if request.requestHandle != nil && v.hasResponder == false { - request.requestHandle(oParam.Interface(), ConvertError(err)) + if v.hasResponder == false && requestHanle != nil { + requestHanle(oParam.Interface(), ConvertError(err)) } }