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

@@ -17,7 +17,9 @@
#include "blackcore/db/databasereader.h"
#include "blackmisc/aviation/airportlist.h"
#include "blackmisc/network/entityflags.h"
#include <QNetworkAccessManager>
#include <atomic>
namespace BlackCore
{
@@ -73,7 +75,8 @@ namespace BlackCore
BlackMisc::Db::CDbFlags::DataRetrievalModeFlag mode = BlackMisc::Db::CDbFlags::DbReading, const QDateTime &newerThan = QDateTime());
private:
BlackMisc::CData<BlackCore::Data::TDbAirportCache> m_airportCache {this, &CAirportDataReader::airportCacheChanged};
BlackMisc::CData<BlackCore::Data::TDbAirportCache> m_airportCache {this, &CAirportDataReader::airportCacheChanged}; //!< cache file
std::atomic_bool m_syncedAirportCache { false }; //!< already synchronized?
//! Reader URL (we read from where?) used to detect changes of location
BlackMisc::CData<BlackCore::Data::TDbModelReaderBaseUrl> m_readerUrlCache {this, &CAirportDataReader::baseUrlCacheChanged };