mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-15 09:44:31 +02:00
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(),
|
m_Rcon = new RedisConnection(GetHost(), GetPort(), GetPath(), GetPassword(), GetDbIndex(),
|
||||||
GetEnableTls(), GetInsecureNoverify(), GetCertPath(), GetKeyPath(), GetCaPath(), GetCrlPath(),
|
GetEnableTls(), GetInsecureNoverify(), GetCertPath(), GetKeyPath(), GetCaPath(), GetCrlPath(),
|
||||||
GetTlsProtocolmin(), GetCipherList(), GetDebugInfo());
|
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_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();
|
m_Rcon->Start();
|
||||||
|
|
||||||
for (const Type::Ptr& type : GetTypes()) {
|
for (const Type::Ptr& type : GetTypes()) {
|
||||||
@ -77,11 +87,9 @@ void IcingaDB::Start(bool runtimeCreated)
|
|||||||
if (!ctype)
|
if (!ctype)
|
||||||
continue;
|
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(),
|
GetEnableTls(), GetInsecureNoverify(), GetCertPath(), GetKeyPath(), GetCaPath(), GetCrlPath(),
|
||||||
GetTlsProtocolmin(), GetCipherList(), GetDebugInfo(), m_Rcon));
|
GetTlsProtocolmin(), GetCipherList(), GetDebugInfo(), m_Rcon);
|
||||||
rCon->Start();
|
|
||||||
m_Rcons[ctype] = std::move(rCon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_StatsTimer = new Timer();
|
m_StatsTimer = new Timer();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user