Merge pull request #7764 from Icinga/bugfix/fix-crash-in-docker-environments

IcingaDB::UpdateState: Check for Redis connection before calling FireAndForgetQuery()
This commit is contained in:
Noah Hilverling 2020-01-17 14:53:56 +01:00 committed by GitHub
commit 18eb06e334
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);