mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
Code style
This commit is contained in:
parent
0634e27d6d
commit
1d21626b30
@ -75,7 +75,7 @@ void RedisConnection::HandleRW()
|
|||||||
|
|
||||||
void RedisConnection::RedisInitialCallback(redisAsyncContext *c, void *r, void *p)
|
void RedisConnection::RedisInitialCallback(redisAsyncContext *c, void *r, void *p)
|
||||||
{
|
{
|
||||||
auto *state = (ConnectionState *) p;
|
auto state = (ConnectionState *) p;
|
||||||
if (state->state != Starting && !r) {
|
if (state->state != Starting && !r) {
|
||||||
Log(LogCritical, "RedisConnection")
|
Log(LogCritical, "RedisConnection")
|
||||||
<< "No answer from Redis during initial connection, is the Redis server running?";
|
<< "No answer from Redis during initial connection, is the Redis server running?";
|
||||||
|
@ -81,9 +81,9 @@ void RedisWriter::UpdateAllConfigObjects()
|
|||||||
|
|
||||||
upq.ParallelFor(types, [this](const TypePair& type) {
|
upq.ParallelFor(types, [this](const TypePair& type) {
|
||||||
size_t bulkCounter = 0;
|
size_t bulkCounter = 0;
|
||||||
std::vector<String> attributes = std::vector<String>({"HMSET", m_PrefixConfigObject + type.second});
|
auto attributes = std::vector<String>({"HMSET", m_PrefixConfigObject + type.second});
|
||||||
std::vector<String> customVars = std::vector<String>({"HMSET", m_PrefixConfigCustomVar + type.second});
|
auto customVars = std::vector<String>({"HMSET", m_PrefixConfigCustomVar + type.second});
|
||||||
std::vector<String> checksums = std::vector<String>({"HMSET", m_PrefixConfigCheckSum + type.second});
|
auto checksums = std::vector<String>({"HMSET", m_PrefixConfigCheckSum + type.second});
|
||||||
|
|
||||||
for (const ConfigObject::Ptr& object : type.first->GetObjects()) {
|
for (const ConfigObject::Ptr& object : type.first->GetObjects()) {
|
||||||
CreateConfigUpdate(object, attributes, customVars, checksums, false);
|
CreateConfigUpdate(object, attributes, customVars, checksums, false);
|
||||||
@ -138,9 +138,9 @@ static ConfigObject::Ptr GetObjectByName(const String& name)
|
|||||||
void RedisWriter::SendConfigUpdate(const ConfigObject::Ptr& object, bool runtimeUpdate)
|
void RedisWriter::SendConfigUpdate(const ConfigObject::Ptr& object, bool runtimeUpdate)
|
||||||
{
|
{
|
||||||
String typeName = object->GetReflectionType()->GetName().ToLower();
|
String typeName = object->GetReflectionType()->GetName().ToLower();
|
||||||
std::vector<String> attributes = std::vector<String>({"HMSET", m_PrefixConfigObject + typeName});
|
auto attributes = std::vector<String>({"HMSET", m_PrefixConfigObject + typeName});
|
||||||
std::vector<String> customVars = std::vector<String>({"HMSET", m_PrefixConfigCustomVar + typeName});
|
auto customVars = std::vector<String>({"HMSET", m_PrefixConfigCustomVar + typeName});
|
||||||
std::vector<String> checksums = std::vector<String>({"HMSET", m_PrefixConfigCheckSum + typeName});
|
auto checksums = std::vector<String>({"HMSET", m_PrefixConfigCheckSum + typeName});
|
||||||
|
|
||||||
CreateConfigUpdate(object, attributes, customVars, checksums, runtimeUpdate);
|
CreateConfigUpdate(object, attributes, customVars, checksums, runtimeUpdate);
|
||||||
|
|
||||||
|
@ -138,11 +138,14 @@ void RedisWriter::UpdateSubscriptions()
|
|||||||
|
|
||||||
Log(LogInformation, "RedisWriter", "Updating Redis subscriptions");
|
Log(LogInformation, "RedisWriter", "Updating Redis subscriptions");
|
||||||
|
|
||||||
if (!m_Rcon->IsConnected()) {
|
/* TODO:
|
||||||
Log(LogCritical, "DEBUG, Redis")
|
* Silently return in this case. Usually the RedisConnection checks for connectivity and logs in failure case.
|
||||||
<< "NO CONNECT CHIEF";
|
* But since we expect and answer here and break Icinga in case of receiving no answer/an unexpected one we opt for
|
||||||
|
* better safe than sorry here. Future implementation needs to include an improved error handling and answer verification.
|
||||||
|
*/
|
||||||
|
if (!m_Rcon->IsConnected())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
long long cursor = 0;
|
long long cursor = 0;
|
||||||
|
|
||||||
String keyPrefix = "icinga:subscription:";
|
String keyPrefix = "icinga:subscription:";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user