Implement the db_index property for the RedisWriter class

fixes #5081
This commit is contained in:
Gunnar Beutner 2017-03-20 13:47:37 +01:00 committed by Michael Friedrich
parent 1bbdd082b0
commit 6b48a36192
2 changed files with 20 additions and 0 deletions

View File

@ -112,6 +112,25 @@ void RedisWriter::TryToReconnect(void)
freeReplyObject(reply);
}
int dbIndex = GetDbIndex();
if (dbIndex != 0) {
redisReply *reply = reinterpret_cast<redisReply *>(redisCommand(m_Context, "SELECT %d", dbIndex));
if (!reply) {
redisFree(m_Context);
m_Context = NULL;
return;
}
if (reply->type == REDIS_REPLY_STATUS || reply->type == REDIS_REPLY_ERROR) {
Log(LogInformation, "RedisWriter")
<< "SELECT " << dbIndex << ": " << reply->str;
}
freeReplyObject(reply);
}
/* Config dump */
UpdateAllConfigObjects();
}

View File

@ -34,6 +34,7 @@ class RedisWriter : ConfigObject
};
[config] String path;
[config] String password;
[config] int db_index;
};
}