mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 13:55:36 +08:00
Ref T150, use network watchdog with web data services
* removed own checks and use watchdog * connect with readers to avoid redundant checks
This commit is contained in:
committed by
Mathew Sutcliffe
parent
46d2f2c048
commit
a4de52852d
@@ -177,12 +177,6 @@ namespace BlackCore
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWebDataServices::canConnectSwiftDb(bool strict) const
|
|
||||||
{
|
|
||||||
if (!strict && this->hasConnectedSwiftDb()) { return true; }
|
|
||||||
return CNetworkUtils::canConnect(sApp->getGlobalSetup().getDbHomePageUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWebDataServices::resetSignalFlags()
|
void CWebDataServices::resetSignalFlags()
|
||||||
{
|
{
|
||||||
m_signalledEntities.clear();
|
m_signalledEntities.clear();
|
||||||
@@ -787,11 +781,6 @@ namespace BlackCore
|
|||||||
if (m_databaseWriter) { m_databaseWriter->gracefulShutdown(); }
|
if (m_databaseWriter) { m_databaseWriter->gracefulShutdown(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
CUrl CWebDataServices::getDbReaderCurrentSharedDbDataUrl() const
|
|
||||||
{
|
|
||||||
return CDatabaseReader::getCurrentSharedDbDataUrl();
|
|
||||||
}
|
|
||||||
|
|
||||||
CEntityFlags::Entity CWebDataServices::allDbEntitiesForUsedReaders() const
|
CEntityFlags::Entity CWebDataServices::allDbEntitiesForUsedReaders() const
|
||||||
{
|
{
|
||||||
// obtain entities from real readers (means when reader is really used)
|
// obtain entities from real readers (means when reader is really used)
|
||||||
@@ -834,7 +823,7 @@ namespace BlackCore
|
|||||||
// 1a. If any DB data, read the info objects upfront
|
// 1a. If any DB data, read the info objects upfront
|
||||||
if (needsDbInfoObjects)
|
if (needsDbInfoObjects)
|
||||||
{
|
{
|
||||||
const bool databaseUp = CInfoDataReader::canPingSwiftServer();
|
const bool databaseUp = sApp->isSwiftDbAccessible();
|
||||||
if (!databaseUp) { dbReaderConfig.markAsDbDown(); }
|
if (!databaseUp) { dbReaderConfig.markAsDbDown(); }
|
||||||
|
|
||||||
if (anyDbEntities && readersNeeded.testFlag(CWebReaderFlags::WebReaderFlag::DbInfoDataReader))
|
if (anyDbEntities && readersNeeded.testFlag(CWebReaderFlags::WebReaderFlag::DbInfoDataReader))
|
||||||
@@ -919,6 +908,8 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect ICAO reader signals");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect ICAO reader signals");
|
||||||
c = connect(m_icaoDataReader, &CIcaoDataReader::dataRead, this, &CWebDataServices::dataRead);
|
c = connect(m_icaoDataReader, &CIcaoDataReader::dataRead, this, &CWebDataServices::dataRead);
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect ICAO reader signals");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect ICAO reader signals");
|
||||||
|
c = connect(m_icaoDataReader, &CIcaoDataReader::swiftDbDataRead, this, &CWebDataServices::swiftDbDataRead);
|
||||||
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||||
m_icaoDataReader->start(QThread::LowPriority);
|
m_icaoDataReader->start(QThread::LowPriority);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -930,6 +921,8 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||||
c = connect(m_modelDataReader, &CModelDataReader::dataRead, this, &CWebDataServices::dataRead);
|
c = connect(m_modelDataReader, &CModelDataReader::dataRead, this, &CWebDataServices::dataRead);
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||||
|
c = connect(m_modelDataReader, &CModelDataReader::swiftDbDataRead, this, &CWebDataServices::swiftDbDataRead);
|
||||||
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||||
m_modelDataReader->start(QThread::LowPriority);
|
m_modelDataReader->start(QThread::LowPriority);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -941,6 +934,8 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||||
c = connect(m_airportDataReader, &CAirportDataReader::dataRead, this, &CWebDataServices::dataRead);
|
c = connect(m_airportDataReader, &CAirportDataReader::dataRead, this, &CWebDataServices::dataRead);
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||||
|
c = connect(m_airportDataReader, &CAirportDataReader::swiftDbDataRead, this, &CWebDataServices::swiftDbDataRead);
|
||||||
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Cannot connect Model reader signals");
|
||||||
m_airportDataReader->start(QThread::LowPriority);
|
m_airportDataReader->start(QThread::LowPriority);
|
||||||
}
|
}
|
||||||
Q_UNUSED(c); // signal connect flag
|
Q_UNUSED(c); // signal connect flag
|
||||||
|
|||||||
@@ -119,9 +119,6 @@ namespace BlackCore
|
|||||||
//! Reader flags
|
//! Reader flags
|
||||||
CWebReaderFlags::WebReader getReaderFlags() const { return m_readers; }
|
CWebReaderFlags::WebReader getReaderFlags() const { return m_readers; }
|
||||||
|
|
||||||
//! Currently used URL for shared DB data
|
|
||||||
BlackMisc::Network::CUrl getDbReaderCurrentSharedDbDataUrl() const;
|
|
||||||
|
|
||||||
//! All DB entities for those readers used and not ignored
|
//! All DB entities for those readers used and not ignored
|
||||||
BlackMisc::Network::CEntityFlags::Entity allDbEntitiesForUsedReaders() const;
|
BlackMisc::Network::CEntityFlags::Entity allDbEntitiesForUsedReaders() const;
|
||||||
|
|
||||||
@@ -404,9 +401,6 @@ namespace BlackCore
|
|||||||
//! Has already connect swift DB?
|
//! Has already connect swift DB?
|
||||||
bool hasConnectedSwiftDb() const;
|
bool hasConnectedSwiftDb() const;
|
||||||
|
|
||||||
//! Can connect swift DB?
|
|
||||||
bool canConnectSwiftDb(bool strict = false) const;
|
|
||||||
|
|
||||||
//! Reset the flags what was already signaled
|
//! Reset the flags what was already signaled
|
||||||
void resetSignalFlags();
|
void resetSignalFlags();
|
||||||
|
|
||||||
@@ -426,6 +420,9 @@ namespace BlackCore
|
|||||||
//! Combined read signal
|
//! Combined read signal
|
||||||
void dataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
void dataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||||
|
|
||||||
|
//! DB data read
|
||||||
|
void swiftDbDataRead(bool success);
|
||||||
|
|
||||||
// simplified signals follow
|
// simplified signals follow
|
||||||
// 1) simple signature
|
// 1) simple signature
|
||||||
// 2) fired directly after read, no need to wait for other entities
|
// 2) fired directly after read, no need to wait for other entities
|
||||||
|
|||||||
Reference in New Issue
Block a user