From 318a547d8be161a46bc76ba34786ad91bf9fd503 Mon Sep 17 00:00:00 2001 From: crusader Date: Sun, 29 Apr 2018 19:08:48 +0900 Subject: [PATCH] ing --- client/client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index ca391da..d2c6053 100644 --- a/client/client.go +++ b/client/client.go @@ -21,6 +21,7 @@ type Client struct { RPCInvoker registry.RPCInvoker Name string PendingRequests int + RequestTimeout time.Duration stopChan chan struct{} stopWg sync.WaitGroup @@ -52,6 +53,10 @@ func (c *Client) Start() error { c.PendingRequests = 1024 } + if 0 >= c.RequestTimeout { + c.RequestTimeout = 20 * time.Second + } + readChan, writeChan, err := c.Connector.Connect() if nil != err { return err @@ -88,7 +93,7 @@ func (c *Client) Send(method string, params ...interface{}) error { } func (c *Client) Call(result interface{}, method string, params ...interface{}) error { - return c.CallTimeout(10, result, method, params...) + return c.CallTimeout(c.RequestTimeout, result, method, params...) } func (c *Client) CallTimeout(timeout time.Duration, result interface{}, method string, params ...interface{}) error {