diff --git a/src/blackcore/airspaceanalyzer.cpp b/src/blackcore/airspaceanalyzer.cpp index a9cd7fb26..c93235021 100644 --- a/src/blackcore/airspaceanalyzer.cpp +++ b/src/blackcore/airspaceanalyzer.cpp @@ -148,14 +148,21 @@ namespace BlackCore void CAirspaceAnalyzer::watchdogCheckTimeouts() { + // this is a trick to not remove everything while debugging const qint64 currentTimeMsEpoch = QDateTime::currentMSecsSinceEpoch(); const qint64 callDiffMs = currentTimeMsEpoch - m_lastWatchdogCallMsSinceEpoch; const qint64 callThresholdMs = static_cast(m_updateTimer.interval() * 1.5); m_lastWatchdogCallMsSinceEpoch = currentTimeMsEpoch; + if (callDiffMs > callThresholdMs) + { + // allow some time to normalize before checking again + m_doNotRunAgainBefore = currentTimeMsEpoch + 2 * callThresholdMs; + return; + } + if (m_doNotRunAgainBefore > currentTimeMsEpoch) { return; } + m_doNotRunAgainBefore = -1; - // this is a trick to not remove everything while debugging - if (callDiffMs > callThresholdMs) { return; } - + // checks const qint64 aircraftTimeoutMs = m_timeoutAircraft.valueInteger(CTimeUnit::ms()); const qint64 atcTimeoutMs = m_timeoutAtc.valueInteger(CTimeUnit::ms()); const qint64 timeoutAircraftEpochMs = currentTimeMsEpoch - aircraftTimeoutMs; diff --git a/src/blackcore/airspaceanalyzer.h b/src/blackcore/airspaceanalyzer.h index 6f1890b9c..a392fd6e6 100644 --- a/src/blackcore/airspaceanalyzer.h +++ b/src/blackcore/airspaceanalyzer.h @@ -130,6 +130,7 @@ namespace BlackCore BlackMisc::PhysicalQuantities::CTime m_timeoutAircraft = { 15, BlackMisc::PhysicalQuantities::CTimeUnit::s() }; //!< Timeout value for watchdog functionality BlackMisc::PhysicalQuantities::CTime m_timeoutAtc = { 50, BlackMisc::PhysicalQuantities::CTimeUnit::s() }; //!< Timeout value for watchdog functionality qint64 m_lastWatchdogCallMsSinceEpoch; //!< when last called + qint64 m_doNotRunAgainBefore = -1; //!< do not run again before, also used to detect debugging std::atomic_bool m_enabledWatchdog { true }; //!< watchdog enabled // snapshot