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

@@ -26,6 +26,7 @@
#include <QObject>
#include <QReadWriteLock>
#include <QString>
#include <atomic>
class QDateTime;
class QNetworkReply;
@@ -162,6 +163,9 @@ namespace BlackCore
BlackMisc::CData<BlackCore::Data::TDbAircraftIcaoCache> m_aircraftIcaoCache {this, &CIcaoDataReader::aircraftIcaoCacheChanged };
BlackMisc::CData<BlackCore::Data::TDbAirlineIcaoCache> m_airlineIcaoCache {this, &CIcaoDataReader::airlineIcaoCacheChanged };
BlackMisc::CData<BlackCore::Data::TDbCountryCache> m_countryCache {this, &CIcaoDataReader::countryCacheChanged };
std::atomic_bool m_syncedAircraftIcaoCache { false }; //!< already synchronized?
std::atomic_bool m_syncedAirlineIcaoCache { false }; //!< already synchronized?
std::atomic_bool m_syncedCountryCache { false }; //!< already synchronized?
//! Reader URL (we read from where?) used to detect changes of location
BlackMisc::CData<BlackCore::Data::TDbIcaoReaderBaseUrl> m_readerUrlCache {this, &CIcaoDataReader::baseUrlCacheChanged };