Skip to content
Snippets Groups Projects
Commit e438cb09 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Add early out to disk cache purge for shutdown

parent 7c88760d
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -120,6 +120,11 @@ void LLDiskCache::purge()
{
for (auto& entry : boost::make_iterator_range(dir_iter, {}))
{
if(!LLApp::isRunning())
{
return;
}
if (boost::filesystem::is_regular_file(entry, ec) && !ec.failed())
{
if (entry.path().string().rfind(sCacheFilenameExt) != std::string::npos)
......@@ -157,9 +162,15 @@ void LLDiskCache::purge()
{
file_removed.reserve(file_info.size());
}
uintmax_t file_size_total = 0;
for (const file_info_t& entry : file_info)
{
if (!LLApp::isRunning())
{
return;
}
file_size_total += entry.second.first;
bool should_remove = file_size_total > mMaxSizeBytes;
......@@ -200,6 +211,11 @@ void LLDiskCache::purge()
// Logging thousands of file results can take hundreds of milliseconds
for (size_t i = 0; i < file_info.size(); ++i)
{
if (!LLApp::isRunning())
{
return;
}
const file_info_t& entry = file_info[i];
const bool removed = file_removed[i];
const std::string action = removed ? "DELETE:" : "KEEP:";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment