mirror of https://github.com/Icinga/icinga2.git
Drop redundant `CpuBoundWork` usage in `JsonRpcConnection::Disconnect()`
Although there is locking involved here, it shoudln't take too long for the thread to actually acquire it, since there aren't that many threads dealing with endpoint clients concurrently. It's just wasting pointless time trying to obtain a CPU slot.
This commit is contained in:
parent
01a6c4c1ce
commit
e2793f1d88
|
@ -199,15 +199,15 @@ void JsonRpcConnection::Disconnect()
|
||||||
Log(LogWarning, "JsonRpcConnection")
|
Log(LogWarning, "JsonRpcConnection")
|
||||||
<< "API client disconnected for identity '" << m_Identity << "'";
|
<< "API client disconnected for identity '" << m_Identity << "'";
|
||||||
|
|
||||||
{
|
// We need to unregister the endpoint client as soon as possible not to confuse Icinga 2,
|
||||||
CpuBoundWork removeClient (yc);
|
// given that Endpoint::GetConnected() is just performing a check that the endpoint's client
|
||||||
|
// cache is not empty, which could result in an already disconnected endpoint never trying to
|
||||||
|
// reconnect again. See #7444.
|
||||||
if (m_Endpoint) {
|
if (m_Endpoint) {
|
||||||
m_Endpoint->RemoveClient(this);
|
m_Endpoint->RemoveClient(this);
|
||||||
} else {
|
} else {
|
||||||
ApiListener::GetInstance()->RemoveAnonymousClient(this);
|
ApiListener::GetInstance()->RemoveAnonymousClient(this);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_OutgoingMessagesQueued.Set();
|
m_OutgoingMessagesQueued.Set();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue