Code style

This commit is contained in:
Jean Flach 2018-10-26 15:01:05 +02:00 committed by Michael Friedrich
parent 0634e27d6d
commit 1d21626b30
3 changed files with 14 additions and 11 deletions

View File

@ -75,7 +75,7 @@ void RedisConnection::HandleRW()
void RedisConnection::RedisInitialCallback(redisAsyncContext *c, void *r, void *p)
{
auto *state = (ConnectionState *) p;
auto state = (ConnectionState *) p;
if (state->state != Starting && !r) {
Log(LogCritical, "RedisConnection")
<< "No answer from Redis during initial connection, is the Redis server running?";

View File

@ -81,9 +81,9 @@ void RedisWriter::UpdateAllConfigObjects()
upq.ParallelFor(types, [this](const TypePair& type) {
size_t bulkCounter = 0;
std::vector<String> attributes = std::vector<String>({"HMSET", m_PrefixConfigObject + type.second});
std::vector<String> customVars = std::vector<String>({"HMSET", m_PrefixConfigCustomVar + type.second});
std::vector<String> checksums = std::vector<String>({"HMSET", m_PrefixConfigCheckSum + type.second});
auto attributes = std::vector<String>({"HMSET", m_PrefixConfigObject + type.second});
auto customVars = std::vector<String>({"HMSET", m_PrefixConfigCustomVar + type.second});
auto checksums = std::vector<String>({"HMSET", m_PrefixConfigCheckSum + type.second});
for (const ConfigObject::Ptr& object : type.first->GetObjects()) {
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)
{
String typeName = object->GetReflectionType()->GetName().ToLower();
std::vector<String> attributes = std::vector<String>({"HMSET", m_PrefixConfigObject + typeName});
std::vector<String> customVars = std::vector<String>({"HMSET", m_PrefixConfigCustomVar + typeName});
std::vector<String> checksums = std::vector<String>({"HMSET", m_PrefixConfigCheckSum + typeName});
auto attributes = std::vector<String>({"HMSET", m_PrefixConfigObject + typeName});
auto customVars = std::vector<String>({"HMSET", m_PrefixConfigCustomVar + typeName});
auto checksums = std::vector<String>({"HMSET", m_PrefixConfigCheckSum + typeName});
CreateConfigUpdate(object, attributes, customVars, checksums, runtimeUpdate);

View File

@ -138,11 +138,14 @@ void RedisWriter::UpdateSubscriptions()
Log(LogInformation, "RedisWriter", "Updating Redis subscriptions");
if (!m_Rcon->IsConnected()) {
Log(LogCritical, "DEBUG, Redis")
<< "NO CONNECT CHIEF";
/* TODO:
* Silently return in this case. Usually the RedisConnection checks for connectivity and logs in failure case.
* 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;
}
long long cursor = 0;
String keyPrefix = "icinga:subscription:";