Add checks to prevent files being saved before being fully read.

This commit is contained in:
AdenKoperczak 2025-01-29 11:04:17 -05:00
parent f3c846f0b1
commit bc79ed11a3
5 changed files with 31 additions and 1 deletions

View file

@ -70,6 +70,8 @@ public:
boost::unordered_flat_map<std::string, std::shared_ptr<PlacefileRecord>>
placefileRecordMap_ {};
std::shared_mutex placefileRecordLock_ {};
bool placefileSettingsRead_ {false};
};
class PlacefileManager::Impl::PlacefileRecord
@ -413,10 +415,15 @@ void PlacefileManager::Impl::ReadPlacefileSettings()
}
}
}
placefileSettingsRead_ = true;
}
void PlacefileManager::Impl::WritePlacefileSettings()
{
if (!placefileSettingsRead_)
{
return;
}
logger_->info("Saving placefile settings");
std::shared_lock lock {placefileRecordLock_};