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