This commit is contained in:
@ -151,8 +151,14 @@ auto file_manager::evict_file(const std::string &api_path) -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
filesystem_item fsi{};
|
||||
auto res = provider_.get_filesystem_item(api_path, false, fsi);
|
||||
if (res != api_error::success) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string pinned;
|
||||
auto res = provider_.get_item_meta(api_path, META_PINNED, pinned);
|
||||
res = provider_.get_item_meta(api_path, META_PINNED, pinned);
|
||||
if (res != api_error::success && res != api_error::item_not_found) {
|
||||
utils::error::raise_api_path_error(std::string{function_name}, api_path,
|
||||
res, "failed to get pinned status");
|
||||
@ -184,10 +190,9 @@ auto file_manager::evict_file(const std::string &api_path) -> bool {
|
||||
closeable_file.reset();
|
||||
|
||||
auto file = utils::file::file{source_path};
|
||||
auto file_size = file.size().value_or(0U);
|
||||
auto removed = file.remove();
|
||||
if (removed) {
|
||||
res = cache_size_mgr::instance().shrink(file_size);
|
||||
res = cache_size_mgr::instance().shrink(fsi.size);
|
||||
if (res != api_error::success) {
|
||||
utils::error::raise_api_path_error(function_name, api_path, res,
|
||||
"failed to shrink cache");
|
||||
|
Reference in New Issue
Block a user