mirror of https://github.com/status-im/consul.git
Switches to using a read lock for the agent's RPC dispatcher.
This prevents RPC calls from getting serialized in this spot. Fixes #3376
This commit is contained in:
parent
6194dcf36f
commit
f51d56c80c
|
@ -5,6 +5,8 @@ FEATURES:
|
||||||
|
|
||||||
IMPROVEMENTS:
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
* agent: Switched to using a read lock for the agent's RPC dispatcher, which prevents RPC calls from getting serialized. [GH-3376]
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
## 0.9.2 (August 9, 2017)
|
## 0.9.2 (August 9, 2017)
|
||||||
|
|
|
@ -956,7 +956,7 @@ func (a *Agent) registerEndpoint(name string, handler interface{}) error {
|
||||||
// RPC is used to make an RPC call to the Consul servers
|
// RPC is used to make an RPC call to the Consul servers
|
||||||
// This allows the agent to implement the Consul.Interface
|
// This allows the agent to implement the Consul.Interface
|
||||||
func (a *Agent) RPC(method string, args interface{}, reply interface{}) error {
|
func (a *Agent) RPC(method string, args interface{}, reply interface{}) error {
|
||||||
a.endpointsLock.Lock()
|
a.endpointsLock.RLock()
|
||||||
// fast path: only translate if there are overrides
|
// fast path: only translate if there are overrides
|
||||||
if len(a.endpoints) > 0 {
|
if len(a.endpoints) > 0 {
|
||||||
p := strings.SplitN(method, ".", 2)
|
p := strings.SplitN(method, ".", 2)
|
||||||
|
@ -964,7 +964,7 @@ func (a *Agent) RPC(method string, args interface{}, reply interface{}) error {
|
||||||
method = e + "." + p[1]
|
method = e + "." + p[1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a.endpointsLock.Unlock()
|
a.endpointsLock.RUnlock()
|
||||||
return a.delegate.RPC(method, args, reply)
|
return a.delegate.RPC(method, args, reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue