This commit is contained in:
@ -91,11 +91,12 @@ void cache_size_mgr::initialize(app_config *cfg) {
|
||||
}
|
||||
|
||||
auto cache_size_mgr::shrink(std::uint64_t size) -> api_error {
|
||||
mutex_lock lock(mtx_);
|
||||
if (size == 0U) {
|
||||
notify_.notify_all();
|
||||
return api_error::success;
|
||||
}
|
||||
|
||||
mutex_lock lock(mtx_);
|
||||
if (cache_size_ >= size) {
|
||||
cache_size_ -= size;
|
||||
} else {
|
||||
|
@ -614,6 +614,12 @@ auto file_manager::remove_source_and_shrink_cache(
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user