mirror of https://github.com/Icinga/icinga2.git
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:
commit
9169c805a8
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue