mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
DB watchdog also emits URL in signal (allows to display the failed URL)
This commit is contained in:
@@ -1064,15 +1064,15 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void CApplication::onChangedSwiftDbAccessibility(bool accessible)
|
||||
void CApplication::onChangedSwiftDbAccessibility(bool accessible, const CUrl &url)
|
||||
{
|
||||
if (accessible)
|
||||
{
|
||||
CLogMessage(this).info("swift DB reported accessible");
|
||||
CLogMessage(this).info("swift DB reported accessible: '%1'") << url.toQString();
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).warning("swift DB not accessible");
|
||||
CLogMessage(this).warning("swift DB not accessible: '%1'") << url.toQString();
|
||||
if (m_networkWatchDog)
|
||||
{
|
||||
CLogMessage(this).warning(m_networkWatchDog->getCheckInfo());
|
||||
|
||||
@@ -492,7 +492,7 @@ namespace BlackCore
|
||||
void changedInternetAccessibility(bool accessible);
|
||||
|
||||
//! DB accessibility changed
|
||||
void changedSwiftDbAccessibility(bool accessible);
|
||||
void changedSwiftDbAccessibility(bool accessible, const BlackMisc::Network::CUrl &testedUrl);
|
||||
|
||||
protected:
|
||||
//! Setup read/synchronized
|
||||
@@ -575,7 +575,7 @@ namespace BlackCore
|
||||
void onChangedInternetAccessibility(bool accessible);
|
||||
|
||||
//! Changed swift DB accessibility
|
||||
void onChangedSwiftDbAccessibility(bool accessible);
|
||||
void onChangedSwiftDbAccessibility(bool accessible, const BlackMisc::Network::CUrl &url);
|
||||
|
||||
//! init logging system
|
||||
void initLogging();
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace BlackCore
|
||||
|
||||
QString CNetworkWatchdog::getCheckInfo() const
|
||||
{
|
||||
static const QString info("Internet accessible: %1 (good: %2/ bad: %3), swift DB accessible: %4 (good: %5/bad: %6)");
|
||||
static const QString info("Internet accessible: %1 (good: %2 / bad: %3), swift DB accessible: %4 (good: %5 / bad: %6)");
|
||||
return info.
|
||||
arg(boolToYesNo(this->isInternetAccessible())).arg(m_goodCountInternet).arg(m_badCountInternet).
|
||||
arg(boolToYesNo(this->isSwiftDbAccessible())).arg(m_goodCountDb).arg(m_badCountDb);
|
||||
@@ -247,11 +247,12 @@ namespace BlackCore
|
||||
// trigger really queued
|
||||
if (oldDbAccessible != m_dbAccessible)
|
||||
{
|
||||
QTimer::singleShot(0, this, [this] { emit this->changedSwiftDbAccessibility(m_dbAccessible);});
|
||||
const CUrl testUrl(this->dbTestUrl());
|
||||
QTimer::singleShot(0, this, [=] { emit this->changedSwiftDbAccessibility(m_dbAccessible, testUrl); });
|
||||
}
|
||||
if (oldInternetAccessible != m_internetAccessible)
|
||||
{
|
||||
QTimer::singleShot(0, this, [this] { emit this->changedInternetAccessibility(m_internetAccessible);});
|
||||
QTimer::singleShot(0, this, [this] { emit this->changedInternetAccessibility(m_internetAccessible); });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +262,7 @@ namespace BlackCore
|
||||
this->setWorkingSharedUrl(workingUrl);
|
||||
}
|
||||
|
||||
BlackMisc::Network::CUrl CNetworkWatchdog::dbTestUrl()
|
||||
CUrl CNetworkWatchdog::dbTestUrl()
|
||||
{
|
||||
// requires global setup to be read
|
||||
const CUrl testUrl(sApp->getGlobalSetup().getDbHomePageUrl());
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace BlackCore
|
||||
|
||||
signals:
|
||||
//! DB was available, but not longer is and vice versa
|
||||
void changedSwiftDbAccessibility(bool available);
|
||||
void changedSwiftDbAccessibility(bool available, const BlackMisc::Network::CUrl &url);
|
||||
|
||||
//! Internet was available, but not longer is and vice versa
|
||||
void changedInternetAccessibility(bool available);
|
||||
|
||||
@@ -38,9 +38,9 @@ namespace BlackGui
|
||||
m_timer.setObjectName("CInfoBarWebReadersStatusBase::CheckSwiftDbTimer");
|
||||
bool c = connect(&m_timer, &QTimer::timeout, this, &CInfoBarWebReadersStatusBase::checkServerAndData);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect");
|
||||
c = connect(sGui, &CGuiApplication::changedInternetAccessibility, this, &CInfoBarWebReadersStatusBase::accessibilityChanged);
|
||||
c = connect(sGui, &CGuiApplication::changedInternetAccessibility, this, &CInfoBarWebReadersStatusBase::networkAccessibilityChanged);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect");
|
||||
c = connect(sGui, &CGuiApplication::changedSwiftDbAccessibility, this, &CInfoBarWebReadersStatusBase::accessibilityChanged);
|
||||
c = connect(sGui, &CGuiApplication::changedSwiftDbAccessibility, this, &CInfoBarWebReadersStatusBase::dbAccessibilityChanged);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect");
|
||||
|
||||
if (sGui->hasWebDataServices())
|
||||
@@ -85,12 +85,19 @@ namespace BlackGui
|
||||
if (!leds.isEmpty()) { this->setLedReadStates(leds, readState); }
|
||||
}
|
||||
|
||||
void CInfoBarWebReadersStatusBase::accessibilityChanged(bool accessible)
|
||||
void CInfoBarWebReadersStatusBase::networkAccessibilityChanged(bool accessible)
|
||||
{
|
||||
Q_UNUSED(accessible);
|
||||
this->checkServerAndData();
|
||||
}
|
||||
|
||||
void CInfoBarWebReadersStatusBase::dbAccessibilityChanged(bool accessible, const CUrl &testedUrl)
|
||||
{
|
||||
Q_UNUSED(accessible);
|
||||
Q_UNUSED(testedUrl);
|
||||
this->checkServerAndData();
|
||||
}
|
||||
|
||||
void CInfoBarWebReadersStatusBase::checkServerAndData()
|
||||
{
|
||||
const bool swift = sGui && sGui->isSwiftDbAccessible();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/led.h"
|
||||
#include "blackmisc/network/url.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
#include <QFrame>
|
||||
@@ -72,8 +73,11 @@ namespace BlackGui
|
||||
//! Data have been read
|
||||
void dataRead(BlackMisc::Network::CEntityFlags::Entity entities, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
//! DB or network accessibility changed
|
||||
void accessibilityChanged(bool accessible);
|
||||
//! Network accessibility changed
|
||||
void networkAccessibilityChanged(bool accessible);
|
||||
|
||||
//! DB accessibility changed
|
||||
void dbAccessibilityChanged(bool accessible, const BlackMisc::Network::CUrl &testedUrl);
|
||||
|
||||
//! Check server status
|
||||
void checkServerAndData();
|
||||
|
||||
Reference in New Issue
Block a user