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)) } }