From e438cb09609841cac1447ff32a56627d7dde1a3f Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Tue, 18 Jul 2023 10:52:17 -0400 Subject: [PATCH] Add early out to disk cache purge for shutdown --- indra/llfilesystem/lldiskcache.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index 502fbb0aef2..c369dbd68a8 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -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:"; -- GitLab