mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 02:06:08 +08:00
Fixed reload all DB data issue reported by MS on slack
* use triggerReloadFromDb * improved documentation MS report: `AllDbEntities` should be `AllDbEntitiesNoInfoObjects` in `CDataInfoAreaComponent::requestUpdateOfAllDbData`? Otherwise it triggers assert `!whatToRead.testFlag(CEntityFlags::InfoObjectEntity)` in `CWebDataServices::triggerRead`.
This commit is contained in:
@@ -244,6 +244,15 @@ namespace BlackCore
|
|||||||
CEntityFlags::Entity CWebDataServices::triggerReloadFromDb(CEntityFlags::Entity whatToRead, const QDateTime &newerThan)
|
CEntityFlags::Entity CWebDataServices::triggerReloadFromDb(CEntityFlags::Entity whatToRead, const QDateTime &newerThan)
|
||||||
{
|
{
|
||||||
CEntityFlags::Entity triggeredRead = CEntityFlags::NoEntity;
|
CEntityFlags::Entity triggeredRead = CEntityFlags::NoEntity;
|
||||||
|
|
||||||
|
if (m_infoDataReader)
|
||||||
|
{
|
||||||
|
// when possible update info objects
|
||||||
|
CEntityFlags::Entity infoObjectEntity = CEntityFlags::InfoObjectEntity;
|
||||||
|
m_infoDataReader->startReadFromDbInBackgroundThread(infoObjectEntity, newerThan);
|
||||||
|
triggeredRead |= infoObjectEntity;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_icaoDataReader)
|
if (m_icaoDataReader)
|
||||||
{
|
{
|
||||||
if (whatToRead.testFlag(CEntityFlags::AircraftIcaoEntity) || whatToRead.testFlag(CEntityFlags::AirlineIcaoEntity) || whatToRead.testFlag(CEntityFlags::CountryEntity))
|
if (whatToRead.testFlag(CEntityFlags::AircraftIcaoEntity) || whatToRead.testFlag(CEntityFlags::AirlineIcaoEntity) || whatToRead.testFlag(CEntityFlags::CountryEntity))
|
||||||
@@ -263,6 +272,17 @@ namespace BlackCore
|
|||||||
triggeredRead |= modelEntities;
|
triggeredRead |= modelEntities;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_airportDataReader)
|
||||||
|
{
|
||||||
|
if (whatToRead.testFlag(CEntityFlags::AirportEntity))
|
||||||
|
{
|
||||||
|
CEntityFlags::Entity airportEntity = whatToRead & CEntityFlags::AirportEntity;
|
||||||
|
m_airportDataReader->startReadFromDbInBackgroundThread(airportEntity, newerThan);
|
||||||
|
triggeredRead |= airportEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return triggeredRead;
|
return triggeredRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -311,9 +311,10 @@ namespace BlackCore
|
|||||||
BlackMisc::CStatusMessageList asyncPublishModels(const BlackMisc::Simulation::CAircraftModelList &models) const;
|
BlackMisc::CStatusMessageList asyncPublishModels(const BlackMisc::Simulation::CAircraftModelList &models) const;
|
||||||
|
|
||||||
//! Trigger read of new data
|
//! Trigger read of new data
|
||||||
|
//! \note requires info objects loaded upfront and uses the full cache logic
|
||||||
BlackMisc::Network::CEntityFlags::Entity triggerRead(BlackMisc::Network::CEntityFlags::Entity whatToRead, const QDateTime &newerThan = QDateTime());
|
BlackMisc::Network::CEntityFlags::Entity triggerRead(BlackMisc::Network::CEntityFlags::Entity whatToRead, const QDateTime &newerThan = QDateTime());
|
||||||
|
|
||||||
//! Trigger reload from DB
|
//! Trigger reload from DB, only loads the DB data and bypasses the caches checks and info objects
|
||||||
BlackMisc::Network::CEntityFlags::Entity triggerReloadFromDb(BlackMisc::Network::CEntityFlags::Entity whatToRead, const QDateTime &newerThan = QDateTime());
|
BlackMisc::Network::CEntityFlags::Entity triggerReloadFromDb(BlackMisc::Network::CEntityFlags::Entity whatToRead, const QDateTime &newerThan = QDateTime());
|
||||||
|
|
||||||
//! Corresponding cache timestamp if applicable
|
//! Corresponding cache timestamp if applicable
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CDataInfoAreaComponent::requestUpdateOfAllDbData()
|
void CDataInfoAreaComponent::requestUpdateOfAllDbData()
|
||||||
{
|
{
|
||||||
sGui->getWebDataServices()->triggerRead(CEntityFlags::AllDbEntities, QDateTime());
|
sGui->getWebDataServices()->triggerReloadFromDb(CEntityFlags::AllDbEntitiesNoInfoObjectsNoAirports, QDateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDataInfoAreaComponent::requestUpdatedData(CEntityFlags::Entity entity)
|
void CDataInfoAreaComponent::requestUpdatedData(CEntityFlags::Entity entity)
|
||||||
|
|||||||
Reference in New Issue
Block a user