diff --git a/src/blackcore/db/networkwatchdog.cpp b/src/blackcore/db/networkwatchdog.cpp index 8c33eb129..672d011ed 100644 --- a/src/blackcore/db/networkwatchdog.cpp +++ b/src/blackcore/db/networkwatchdog.cpp @@ -134,8 +134,17 @@ namespace BlackCore const bool wasInternetAvailable = m_internetAccessible; const bool networkAccessible = this->isNetworkkAccessibleOrCheckDisabled(); const CUrl testUrl(CNetworkWatchdog::dbTestUrl()); - bool canConnectDb = m_checkDbAccessibility && networkAccessible && - CNetworkUtils::canConnect(testUrl, CanConnectTimeMs); // running here in background worker + bool canConnectDb = m_checkDbAccessibility && networkAccessible; + if (canConnectDb) + { + // running here in background worker check twice + canConnectDb = CNetworkUtils::canConnect(testUrl, CanConnectTimeMs); + if (!canConnectDb) + { + canConnectDb = CNetworkUtils::canConnect(testUrl, CanConnectTimeMs); + } + } + if (m_checkDbAccessibility && m_doDetailedCheck && canConnectDb) { // test against real HTTP response @@ -223,6 +232,7 @@ namespace BlackCore // avoid unnecessary signals const int accessiblityInt = static_cast(accessibility); if (m_networkAccessibility == accessiblityInt) { return; } + if (m_disableNetworkCheck) { return; } // ignore with disabled check // shift to thread if (!CThreadUtils::isCurrentThreadObjectThread(this)) @@ -316,9 +326,13 @@ namespace BlackCore if (ok) { + // be a little less verbose + if ((m_totalGoodCountDb % 5 == 0) || m_consecutivePingBadCount > 0) + { + CLogMessage(this).info("Watchdog pinged '%1'") << url; + } m_totalGoodCountDb++; m_consecutivePingBadCount = 0; - CLogMessage(this).info("Watchdog pinged '%1'") << url; } else { diff --git a/src/blackcore/db/networkwatchdog.h b/src/blackcore/db/networkwatchdog.h index 65d79950e..21a30661b 100644 --- a/src/blackcore/db/networkwatchdog.h +++ b/src/blackcore/db/networkwatchdog.h @@ -183,7 +183,7 @@ namespace BlackCore std::atomic_bool m_online { true }; std::atomic_bool m_internetAccessible { true }; std::atomic_bool m_dbAccessible { true }; - std::atomic_bool m_lastClientPingSuccess { true }; + std::atomic_bool m_lastClientPingSuccess { true }; //!< ping swift DB client service std::atomic_bool m_checkDbAccessibility { true }; std::atomic_bool m_checkSharedUrl { true }; std::atomic_bool m_checkInProgress { false }; //!< a check is currently in progress