Merge pull request #8933 from Icinga/bugfix/icinga-db-only-start-multiple-redis-connections-after-the-first-one-succeeded-8920

Icinga DB: only start multiple Redis connections after the first one succeeded
This commit is contained in:
Alexander Aleksandrovič Klimov 2021-07-27 21:52:21 +02:00 committed by GitHub
commit 9169c805a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -67,9 +67,19 @@ void IcingaDB::Start(bool runtimeCreated)
m_Rcon = new RedisConnection(GetHost(), GetPort(), GetPath(), GetPassword(), GetDbIndex(),
GetEnableTls(), GetInsecureNoverify(), GetCertPath(), GetKeyPath(), GetCaPath(), GetCrlPath(),
GetTlsProtocolmin(), GetCipherList(), GetDebugInfo());
m_Rcon->SetConnectedCallback([this](boost::asio::yield_context& yc) {
auto connectedCallback ([this](boost::asio::yield_context& yc) {
m_WorkQueue.Enqueue([this]() { OnConnectedHandler(); });
});
m_Rcon->SetConnectedCallback([this, connectedCallback](boost::asio::yield_context& yc) {
for (auto& kv : m_Rcons) {
kv.second->Start();
}
m_Rcon->SetConnectedCallback(connectedCallback);
connectedCallback(yc);
});
m_Rcon->Start();
for (const Type::Ptr& type : GetTypes()) {
@ -77,11 +87,9 @@ void IcingaDB::Start(bool runtimeCreated)
if (!ctype)
continue;
RedisConnection::Ptr rCon (new RedisConnection(GetHost(), GetPort(), GetPath(), GetPassword(), GetDbIndex(),
m_Rcons[ctype] = new RedisConnection(GetHost(), GetPort(), GetPath(), GetPassword(), GetDbIndex(),
GetEnableTls(), GetInsecureNoverify(), GetCertPath(), GetKeyPath(), GetCaPath(), GetCrlPath(),
GetTlsProtocolmin(), GetCipherList(), GetDebugInfo(), m_Rcon));
rCon->Start();
m_Rcons[ctype] = std::move(rCon);
GetTlsProtocolmin(), GetCipherList(), GetDebugInfo(), m_Rcon);
}
m_StatsTimer = new Timer();