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

This commit is contained in:
Scott E. Graves 2024-09-23 20:35:45 -05:00
parent 49f0425e56
commit 393dc07de8

View File

@ -440,36 +440,38 @@ void base_provider::remove_deleted_files() {
static_cast<const char *>(__FUNCTION__),
};
auto source_list =
utils::file::directory{config_.get_cache_directory()}.get_files();
for (auto &&source_file : source_list) {
filesystem_item fsi{};
auto sp_res =
get_filesystem_item_from_source_path(source_file->get_path(), fsi);
if (sp_res != api_error::item_not_found) {
continue;
}
if (not is_direct_only()) {
auto source_list =
utils::file::directory{config_.get_cache_directory()}.get_files();
for (auto &&source_file : source_list) {
filesystem_item fsi{};
auto sp_res =
get_filesystem_item_from_source_path(source_file->get_path(), fsi);
if (sp_res != api_error::item_not_found) {
continue;
}
auto reference_time =
source_file->get_time(config_.get_eviction_uses_accessed_time()
? utils::file::time_type::accessed
: utils::file::time_type::modified);
if (not reference_time.has_value()) {
continue;
}
auto reference_time =
source_file->get_time(config_.get_eviction_uses_accessed_time()
? utils::file::time_type::accessed
: utils::file::time_type::modified);
if (not reference_time.has_value()) {
continue;
}
auto delay = (config_.get_eviction_delay_mins() * 60UL) *
utils::time::NANOS_PER_SECOND;
if ((reference_time.value() + static_cast<std::uint64_t>(delay)) >=
utils::time::get_time_now()) {
continue;
}
auto delay = (config_.get_eviction_delay_mins() * 60UL) *
utils::time::NANOS_PER_SECOND;
if ((reference_time.value() + static_cast<std::uint64_t>(delay)) >=
utils::time::get_time_now()) {
continue;
}
event_system::instance().raise<orphaned_source_file_detected>(
source_file->get_path());
if (source_file->remove()) {
event_system::instance().raise<orphaned_source_file_removed>(
event_system::instance().raise<orphaned_source_file_detected>(
source_file->get_path());
if (source_file->remove()) {
event_system::instance().raise<orphaned_source_file_removed>(
source_file->get_path());
}
}
}