ing
This commit is contained in:
parent
02c99d388e
commit
318a547d8b
|
@ -21,6 +21,7 @@ type Client struct {
|
||||||
RPCInvoker registry.RPCInvoker
|
RPCInvoker registry.RPCInvoker
|
||||||
Name string
|
Name string
|
||||||
PendingRequests int
|
PendingRequests int
|
||||||
|
RequestTimeout time.Duration
|
||||||
|
|
||||||
stopChan chan struct{}
|
stopChan chan struct{}
|
||||||
stopWg sync.WaitGroup
|
stopWg sync.WaitGroup
|
||||||
|
@ -52,6 +53,10 @@ func (c *Client) Start() error {
|
||||||
c.PendingRequests = 1024
|
c.PendingRequests = 1024
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if 0 >= c.RequestTimeout {
|
||||||
|
c.RequestTimeout = 20 * time.Second
|
||||||
|
}
|
||||||
|
|
||||||
readChan, writeChan, err := c.Connector.Connect()
|
readChan, writeChan, err := c.Connector.Connect()
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return 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 {
|
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 {
|
func (c *Client) CallTimeout(timeout time.Duration, result interface{}, method string, params ...interface{}) error {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user