Merge pull request #9992 from Icinga/remove-redundat-cpu-bound-work

Drop redundant `CpuBoundWork` usage in `JsonRpcConnection::Disconnect()`
This commit is contained in:
Julian Brost 2024-02-13 15:51:34 +01:00 committed by GitHub
commit 2be08aa2e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 8 deletions

View File

@ -197,14 +197,14 @@ 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
if (m_Endpoint) { // reconnect again. See #7444.
m_Endpoint->RemoveClient(this); if (m_Endpoint) {
} else { m_Endpoint->RemoveClient(this);
ApiListener::GetInstance()->RemoveAnonymousClient(this); } else {
} ApiListener::GetInstance()->RemoveAnonymousClient(this);
} }
m_OutgoingMessagesQueued.Set(); m_OutgoingMessagesQueued.Set();