diff --git a/wxdata/include/scwx/provider/aws_level2_chunks_data_provider.hpp b/wxdata/include/scwx/provider/aws_level2_chunks_data_provider.hpp index 476ff111..abd70787 100644 --- a/wxdata/include/scwx/provider/aws_level2_chunks_data_provider.hpp +++ b/wxdata/include/scwx/provider/aws_level2_chunks_data_provider.hpp @@ -53,9 +53,7 @@ public: LoadObjectByKey(const std::string& key) override; std::shared_ptr LoadObjectByTime(std::chrono::system_clock::time_point time) override; - std::shared_ptr LoadLatestObject() override; - std::shared_ptr LoadSecondLatestObject() override; - std::pair Refresh() override; + std::pair Refresh() override; void RequestAvailableProducts() override; std::vector GetAvailableProducts() override; diff --git a/wxdata/include/scwx/provider/aws_nexrad_data_provider.hpp b/wxdata/include/scwx/provider/aws_nexrad_data_provider.hpp index b2946f38..d6ddcd7c 100644 --- a/wxdata/include/scwx/provider/aws_nexrad_data_provider.hpp +++ b/wxdata/include/scwx/provider/aws_nexrad_data_provider.hpp @@ -48,8 +48,6 @@ public: LoadObjectByKey(const std::string& key) override; std::shared_ptr LoadObjectByTime(std::chrono::system_clock::time_point time) override; - std::shared_ptr LoadLatestObject() override; - std::shared_ptr LoadSecondLatestObject() override; std::pair Refresh() override; protected: diff --git a/wxdata/include/scwx/provider/nexrad_data_provider.hpp b/wxdata/include/scwx/provider/nexrad_data_provider.hpp index dc490be0..2a7320d2 100644 --- a/wxdata/include/scwx/provider/nexrad_data_provider.hpp +++ b/wxdata/include/scwx/provider/nexrad_data_provider.hpp @@ -98,20 +98,6 @@ public: virtual std::shared_ptr LoadObjectByTime(std::chrono::system_clock::time_point time) = 0; - /** - * Loads the latest NEXRAD file object - * - * @return NEXRAD data - */ - virtual std::shared_ptr LoadLatestObject() = 0; - - /** - * Loads the second NEXRAD file object - * - * @return NEXRAD data - */ - virtual std::shared_ptr LoadSecondLatestObject() = 0; - /** * Lists NEXRAD objects for the current date, and adds them to the cache. If * no objects have been added to the cache for the current date, the previous diff --git a/wxdata/source/scwx/provider/aws_level2_chunks_data_provider.cpp b/wxdata/source/scwx/provider/aws_level2_chunks_data_provider.cpp index bb1b31c1..672ee582 100644 --- a/wxdata/source/scwx/provider/aws_level2_chunks_data_provider.cpp +++ b/wxdata/source/scwx/provider/aws_level2_chunks_data_provider.cpp @@ -205,16 +205,20 @@ size_t AwsLevel2ChunksDataProvider::cache_size() const std::chrono::system_clock::time_point AwsLevel2ChunksDataProvider::last_modified() const { + // There is a slight delay between the "modified time" and when it is + // actually available. Radar product manager uses this as available time + static const auto extra = std::chrono::seconds(2); + const std::shared_lock lock(p->scansMutex_); if (p->currentScan_.valid_ && p->currentScan_.lastModified_ != std::chrono::system_clock::time_point {}) { - return p->currentScan_.lastModified_; + return p->currentScan_.lastModified_ + extra; } else if (p->lastScan_.valid_ && p->lastScan_.lastModified_ != std::chrono::system_clock::time_point {}) { - return p->lastScan_.lastModified_; + return p->lastScan_.lastModified_ + extra; } else { @@ -224,20 +228,18 @@ AwsLevel2ChunksDataProvider::last_modified() const std::chrono::seconds AwsLevel2ChunksDataProvider::update_period() const { const std::shared_lock lock(p->scansMutex_); - // Add an extra second of delay - static const auto extra = std::chrono::seconds(2); // get update period from time between chunks if (p->currentScan_.valid_ && p->currentScan_.nextFile_ > 2) { auto delta = p->currentScan_.lastModified_ - p->currentScan_.secondLastModified_; - return std::chrono::duration_cast(delta) + extra; + return std::chrono::duration_cast(delta); } else if (p->lastScan_.valid_ && p->lastScan_.nextFile_ > 2) { auto delta = p->lastScan_.lastModified_ - p->lastScan_.secondLastModified_; - return std::chrono::duration_cast(delta) + extra; + return std::chrono::duration_cast(delta); } // default to a set update period @@ -645,20 +647,6 @@ AwsLevel2ChunksDataProvider::LoadObjectByTime( } } -std::shared_ptr -AwsLevel2ChunksDataProvider::LoadLatestObject() -{ - const std::unique_lock lock(p->scansMutex_); - return std::make_shared(p->currentScan_.nexradFile_, - p->lastScan_.nexradFile_); -} - -std::shared_ptr -AwsLevel2ChunksDataProvider::LoadSecondLatestObject() -{ - return p->lastScan_.nexradFile_; -} - int AwsLevel2ChunksDataProvider::Impl::GetScanNumber(const std::string& prefix) { // KIND/585/20250324-134727-001-S @@ -728,7 +716,7 @@ std::pair AwsLevel2ChunksDataProvider::Refresh() }); } - threadPool.wait(); + threadPool.join(); if (newCurrent) { newObjects += 1; @@ -759,7 +747,7 @@ std::optional AwsLevel2ChunksDataProvider::GetCurrentElevation() { if (!p->currentScan_.valid_ || p->currentScan_.nexradFile_ == nullptr) { - // Does not have any scan elevation. -90 is beyond what is possible + // Does not have any scan elevation. return {}; } @@ -767,7 +755,7 @@ std::optional AwsLevel2ChunksDataProvider::GetCurrentElevation() auto radarData = p->currentScan_.nexradFile_->radar_data(); if (radarData.size() == 0) { - // Does not have any scan elevation. -90 is beyond what is possible + // Does not have any scan elevation. return {}; } diff --git a/wxdata/source/scwx/provider/aws_nexrad_data_provider.cpp b/wxdata/source/scwx/provider/aws_nexrad_data_provider.cpp index c0611804..dceb45d8 100644 --- a/wxdata/source/scwx/provider/aws_nexrad_data_provider.cpp +++ b/wxdata/source/scwx/provider/aws_nexrad_data_provider.cpp @@ -346,17 +346,6 @@ std::shared_ptr AwsNexradDataProvider::LoadObjectByTime( } } -std::shared_ptr AwsNexradDataProvider::LoadLatestObject() -{ - return LoadObjectByKey(FindLatestKey()); -} - -std::shared_ptr -AwsNexradDataProvider::LoadSecondLatestObject() -{ - return nullptr; -} - std::pair AwsNexradDataProvider::Refresh() { using namespace std::chrono;