fix
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...

This commit is contained in:
2024-12-24 21:57:43 -06:00
parent fb9425381e
commit 815d179d82
2 changed files with 8 additions and 1 deletions

View File

@ -91,11 +91,12 @@ void cache_size_mgr::initialize(app_config *cfg) {
} }
auto cache_size_mgr::shrink(std::uint64_t size) -> api_error { auto cache_size_mgr::shrink(std::uint64_t size) -> api_error {
mutex_lock lock(mtx_);
if (size == 0U) { if (size == 0U) {
notify_.notify_all();
return api_error::success; return api_error::success;
} }
mutex_lock lock(mtx_);
if (cache_size_ >= size) { if (cache_size_ >= size) {
cache_size_ -= size; cache_size_ -= size;
} else { } else {

View File

@ -614,6 +614,12 @@ auto file_manager::remove_source_and_shrink_cache(
} }
if (not allocated || source_size == 0U) { if (not allocated || source_size == 0U) {
auto res = cache_size_mgr::instance().shrink(0U);
if (res != api_error::success) {
utils::error::raise_api_path_error(function_name, api_path, source_path,
res, "failed to shrink cache");
}
return true; return true;
} }