mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 06:05:01 +02:00
parent
a5556cbaae
commit
af3e2c429f
@ -42,6 +42,8 @@ void RedisWriter::Start(bool runtimeCreated)
|
||||
|
||||
m_ConfigDumpInProgress = false;
|
||||
|
||||
m_WorkQueue.SetExceptionCallback(boost::bind(&RedisWriter::ExceptionHandler, this, _1));
|
||||
|
||||
m_ReconnectTimer = new Timer();
|
||||
m_ReconnectTimer->SetInterval(15);
|
||||
m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&RedisWriter::ReconnectTimerHandler, this));
|
||||
@ -57,6 +59,19 @@ void RedisWriter::Start(bool runtimeCreated)
|
||||
thread.detach();
|
||||
}
|
||||
|
||||
void RedisWriter::ExceptionHandler(boost::exception_ptr exp)
|
||||
{
|
||||
Log(LogCritical, "RedisWriter", "Exception during redis query. Verify that Redis is operational.");
|
||||
|
||||
Log(LogDebug, "RedisWriter")
|
||||
<< "Exception during redis operation: " << DiagnosticInformation(exp);
|
||||
|
||||
if (m_Context) {
|
||||
redisFree(m_Context);
|
||||
m_Context = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void RedisWriter::ReconnectTimerHandler(void)
|
||||
{
|
||||
m_WorkQueue.Enqueue(boost::bind(&RedisWriter::TryToReconnect, this));
|
||||
@ -275,7 +290,7 @@ boost::shared_ptr<redisReply> RedisWriter::ExecuteQuery(const std::vector<String
|
||||
delete [] argvlen;
|
||||
|
||||
if (reply->type == REDIS_REPLY_ERROR) {
|
||||
Log(LogInformation, "RedisWriter")
|
||||
Log(LogCritical, "RedisWriter")
|
||||
<< "Redis query failed: " << reply->str;
|
||||
|
||||
String msg = reply->str;
|
||||
|
@ -82,6 +82,8 @@ private:
|
||||
|
||||
void AssertOnWorkQueue(void);
|
||||
|
||||
void ExceptionHandler(boost::exception_ptr exp);
|
||||
|
||||
boost::shared_ptr<redisReply> ExecuteQuery(const std::vector<String>& query);
|
||||
|
||||
Timer::Ptr m_ReconnectTimer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user