Hold reference to radar product manager for duration of request

- Avoids early destruction and potential recursive mutex locking
This commit is contained in:
Dan Paulat 2024-05-24 22:47:22 -05:00
parent 2a12b603fc
commit 5caf0edf95
2 changed files with 10 additions and 7 deletions

View file

@ -1022,7 +1022,8 @@ void RadarProductManagerImpl::LoadNexradFile(
std::shared_ptr<wsr88d::NexradFile> nexradFile = load();
std::shared_ptr<types::RadarProductRecord> record = nullptr;
std::shared_ptr<types::RadarProductRecord> record = nullptr;
std::shared_ptr<RadarProductManager> manager = nullptr;
bool fileValid = (nexradFile != nullptr);
@ -1045,9 +1046,7 @@ void RadarProductManagerImpl::LoadNexradFile(
recordRadarId = request->current_radar_site();
}
std::shared_ptr<RadarProductManager> manager =
RadarProductManager::Instance(recordRadarId);
manager = RadarProductManager::Instance(recordRadarId);
manager->Initialize();
record = manager->p->StoreRadarProductRecord(record);
}