IcingaDB::UpdateState: Check for Redis connection before calling FireAndForgetQuery()

This commit is contained in:
Noah Hilverling 2020-01-17 13:53:05 +01:00
parent f11cccf874
commit 0d28ef5abe
1 changed files with 3 additions and 0 deletions

View File

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