From 0d28ef5abe9820894175a585f263ebbdbeffd7ed Mon Sep 17 00:00:00 2001 From: Noah Hilverling Date: Fri, 17 Jan 2020 13:53:05 +0100 Subject: [PATCH] IcingaDB::UpdateState: Check for Redis connection before calling FireAndForgetQuery() --- lib/icingadb/icingadb-objects.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index d280dea30..91b3c7375 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -802,6 +802,9 @@ void IcingaDB::InsertObjectDependencies(const ConfigObject::Ptr& object, const S void IcingaDB::UpdateState(const Checkable::Ptr& checkable) { + if (!m_Rcon || !m_Rcon->IsConnected()) + return; + Dictionary::Ptr stateAttrs = SerializeState(checkable); m_Rcon->FireAndForgetQuery({"HSET", m_PrefixStateObject + GetLowerCaseTypeNameDB(checkable), GetObjectIdentifier(checkable), JsonEncode(stateAttrs)}, Prio::State);