From f34d11a7ea592b865b2a03fc6d37dc1da96a7909 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Wed, 3 Sep 2025 22:38:56 -0500 Subject: [PATCH] RefreshData clang-tidy fixes (cherry picked from commit c630c2969929ce46d96fd4f941f054dcc70d1d8b) --- .../scwx/qt/manager/radar_product_manager.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scwx-qt/source/scwx/qt/manager/radar_product_manager.cpp b/scwx-qt/source/scwx/qt/manager/radar_product_manager.cpp index ce56a165..feda8a7d 100644 --- a/scwx-qt/source/scwx/qt/manager/radar_product_manager.cpp +++ b/scwx-qt/source/scwx/qt/manager/radar_product_manager.cpp @@ -106,7 +106,7 @@ public: group, product, isChunks_, latestTime); }); } - ~ProviderManager() + ~ProviderManager() override { providerThreadPool_.stop(); providerThreadPool_.join(); @@ -797,12 +797,12 @@ void ProviderManager::RefreshData() logger_->trace("RefreshData: {}", name()); { - std::unique_lock lock(refreshTimerMutex_); + const std::unique_lock lock(refreshTimerMutex_); refreshTimer_.cancel(); } boost::asio::post(providerThreadPool_, - [=, this]() + [this]() { try { @@ -841,7 +841,11 @@ void ProviderManager::RefreshDataSync() interval = std::chrono::duration_cast( updatePeriod - sinceLastModified); - if (updatePeriod > 0s && sinceLastModified > updatePeriod * 5) + // Allow 5 update periods before considering the data stale + constexpr std::size_t kUpdatePeriodStaleCount = 5; + + if (updatePeriod > 0s && + sinceLastModified > updatePeriod * kUpdatePeriodStaleCount) { // If it has been at least 5 update periods since the file has // been last modified, slow the retry period @@ -878,7 +882,7 @@ void ProviderManager::RefreshDataSync() { refreshTimer_.expires_after(interval); refreshTimer_.async_wait( - [=, this](const boost::system::error_code& e) + [this](const boost::system::error_code& e) { if (e == boost::system::errc::success) {