Make sure all Redis tasks are executed on the WQ threads

refs #4991
This commit is contained in:
Gunnar Beutner 2017-03-16 14:23:31 +01:00
parent 3a5caf15eb
commit 18e6474f1e
2 changed files with 9 additions and 3 deletions

View File

@ -222,7 +222,7 @@ void RedisWriter::StateChangedHandler(const ConfigObject::Ptr& object)
Type::Ptr type = object->GetReflectionType();
for (const RedisWriter::Ptr& rw : ConfigType::GetObjectsByType<RedisWriter>()) {
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<RedisWriter>()) {
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<RedisWriter>()) {
rw->SendConfigUpdate(object, type->GetName());
rw->m_WorkQueue.Enqueue(boost::bind(&RedisWriter::SendConfigUpdate, rw.get(), object, type->GetName()));
}
}

View File

@ -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) {