From 18e6474f1e3cb49ac0264c1d2245191d5d091b7c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 16 Mar 2017 14:23:31 +0100 Subject: [PATCH] Make sure all Redis tasks are executed on the WQ threads refs #4991 --- lib/redis/rediswriter-config.cpp | 6 +++--- lib/redis/rediswriter.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/redis/rediswriter-config.cpp b/lib/redis/rediswriter-config.cpp index 56d17a567..1a68b748c 100644 --- a/lib/redis/rediswriter-config.cpp +++ b/lib/redis/rediswriter-config.cpp @@ -222,7 +222,7 @@ void RedisWriter::StateChangedHandler(const ConfigObject::Ptr& object) Type::Ptr type = object->GetReflectionType(); for (const RedisWriter::Ptr& rw : ConfigType::GetObjectsByType()) { - rw->SendStatusUpdate(object, type->GetName()); + rw->m_WorkQueue.Enqueue(boost::bind(&RedisWriter::SendStatusUpdate, rw.get(), object, type->GetName())); } } @@ -231,7 +231,7 @@ void RedisWriter::VarsChangedHandler(const ConfigObject::Ptr& object) Type::Ptr type = object->GetReflectionType(); for (const RedisWriter::Ptr& rw : ConfigType::GetObjectsByType()) { - rw->SendConfigUpdate(object, type->GetName()); + rw->m_WorkQueue.Enqueue(boost::bind(&RedisWriter::SendConfigUpdate, rw.get(), object, type->GetName())); } } @@ -240,6 +240,6 @@ void RedisWriter::VersionChangedHandler(const ConfigObject::Ptr& object) Type::Ptr type = object->GetReflectionType(); for (const RedisWriter::Ptr& rw : ConfigType::GetObjectsByType()) { - rw->SendConfigUpdate(object, type->GetName()); + rw->m_WorkQueue.Enqueue(boost::bind(&RedisWriter::SendConfigUpdate, rw.get(), object, type->GetName())); } } diff --git a/lib/redis/rediswriter.cpp b/lib/redis/rediswriter.cpp index f5f7e3ad5..6fba06c29 100644 --- a/lib/redis/rediswriter.cpp +++ b/lib/redis/rediswriter.cpp @@ -141,6 +141,8 @@ void RedisWriter::UpdateSubscriptions(void) if (reply->type == REDIS_REPLY_STATUS || reply->type == REDIS_REPLY_ERROR) { Log(LogInformation, "RedisWriter") << "SCAN " << cursor << " MATCH icinga:subscription:* COUNT 1000: " << reply->str; + + return; } VERIFY(reply->type == REDIS_REPLY_ARRAY); @@ -167,6 +169,8 @@ void RedisWriter::UpdateSubscriptions(void) if (vreply->type == REDIS_REPLY_STATUS || vreply->type == REDIS_REPLY_ERROR) { Log(LogInformation, "RedisWriter") << "GET " << keyReply->str << ": " << vreply->str; + + continue; } subscriptions[keyReply->str] = vreply->str; @@ -271,6 +275,8 @@ void RedisWriter::HandleEvent(const Dictionary::Ptr& event) if (reply->type == REDIS_REPLY_STATUS || reply->type == REDIS_REPLY_ERROR) { Log(LogInformation, "RedisWriter") << "LPUSH icinga:event:" << kv.first << " " << body << ": " << reply->str; + + continue; } if (reply->type == REDIS_REPLY_ERROR) {