This commit is contained in:
@ -186,14 +186,17 @@ auto file_manager::evict_file(const std::string &api_path) -> bool {
|
|||||||
if (open_file_lookup_.contains(api_path)) {
|
if (open_file_lookup_.contains(api_path)) {
|
||||||
closeable_file = open_file_lookup_.at(api_path);
|
closeable_file = open_file_lookup_.at(api_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
open_file_lookup_.erase(api_path);
|
open_file_lookup_.erase(api_path);
|
||||||
open_lock.unlock();
|
|
||||||
|
|
||||||
auto allocated = closeable_file ? closeable_file->get_allocated() : true;
|
auto allocated = closeable_file ? closeable_file->get_allocated() : true;
|
||||||
closeable_file.reset();
|
|
||||||
|
|
||||||
auto removed = remove_source_and_shrink_cache(api_path, source_path, fsi.size,
|
auto removed = remove_source_and_shrink_cache(api_path, source_path, fsi.size,
|
||||||
allocated);
|
allocated);
|
||||||
|
open_lock.unlock();
|
||||||
|
|
||||||
|
closeable_file.reset();
|
||||||
|
|
||||||
if (removed) {
|
if (removed) {
|
||||||
event_system::instance().raise<filesystem_item_evicted>(api_path,
|
event_system::instance().raise<filesystem_item_evicted>(api_path,
|
||||||
source_path);
|
source_path);
|
||||||
@ -558,15 +561,13 @@ auto file_manager::remove_file(const std::string &api_path) -> api_error {
|
|||||||
upload_notify_.notify_all();
|
upload_notify_.notify_all();
|
||||||
upload_lock.unlock();
|
upload_lock.unlock();
|
||||||
|
|
||||||
unique_recur_mutex_lock open_lock(open_file_mtx_);
|
recur_mutex_lock open_lock(open_file_mtx_);
|
||||||
|
|
||||||
res = provider_.remove_file(api_path);
|
res = provider_.remove_file(api_path);
|
||||||
if (res != api_error::success) {
|
if (res != api_error::success) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
open_lock.unlock();
|
|
||||||
|
|
||||||
remove_source_and_shrink_cache(api_path, fsi.source_path, fsi.size,
|
remove_source_and_shrink_cache(api_path, fsi.source_path, fsi.size,
|
||||||
allocated);
|
allocated);
|
||||||
return api_error::success;
|
return api_error::success;
|
||||||
|
Reference in New Issue
Block a user