Ref T292, Ref T285 avoid unnecessary calls of cache synchronize in DB readers

Rational: Normally calling synchronize multiple times does not matter. However, it can time out if the cache is in use (e.g. saving) and create an exception. This exception is just unwanted "noise".
This commit is contained in:
Klaus Basan
2018-07-27 01:11:34 +02:00
parent efbd24e10e
commit c7e6f79a07
6 changed files with 18 additions and 8 deletions

View File

@@ -579,9 +579,9 @@ namespace BlackCore
void CModelDataReader::synchronizeCaches(CEntityFlags::Entity entities)
{
if (entities.testFlag(CEntityFlags::LiveryEntity)) { m_liveryCache.synchronize(); }
if (entities.testFlag(CEntityFlags::ModelEntity)) { m_modelCache.synchronize(); }
if (entities.testFlag(CEntityFlags::DistributorEntity)) { m_distributorCache.synchronize(); }
if (entities.testFlag(CEntityFlags::LiveryEntity)) { if (m_syncedLiveryCache) { return; } m_syncedLiveryCache = true; m_liveryCache.synchronize(); }
if (entities.testFlag(CEntityFlags::ModelEntity)) { if (m_syncedModelCache) { return; } m_syncedModelCache = true; m_modelCache.synchronize(); }
if (entities.testFlag(CEntityFlags::DistributorEntity)) { if (m_syncedDistributorCache) { return; } m_syncedDistributorCache = true; m_distributorCache.synchronize(); }
}
void CModelDataReader::admitCaches(CEntityFlags::Entity entities)