remove logging
This commit is contained in:
parent
f9af43309d
commit
4c97f6b098
@ -47,8 +47,6 @@ auto eviction::check_minimum_requirements(const std::string &file_path)
|
|||||||
|
|
||||||
auto file_size{opt_size.value()};
|
auto file_size{opt_size.value()};
|
||||||
if (file_size == 0U) {
|
if (file_size == 0U) {
|
||||||
event_system::instance().raise<debug_log>(std::string{function_name},
|
|
||||||
file_path, "no file size");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,23 +56,14 @@ auto eviction::check_minimum_requirements(const std::string &file_path)
|
|||||||
: utils::file::time_type::modified);
|
: utils::file::time_type::modified);
|
||||||
|
|
||||||
if (not reference_time.has_value()) {
|
if (not reference_time.has_value()) {
|
||||||
event_system::instance().raise<debug_log>(std::string{function_name},
|
utils::error::raise_error(function_name, utils::get_last_error_code(),
|
||||||
file_path, "no reference_time");
|
file_path, "failed to get file time");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, file_path,
|
|
||||||
std::to_string(reference_time.value()));
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, file_path,
|
|
||||||
std::to_string(reference_time.value() +
|
|
||||||
static_cast<std::uint64_t>(delay)));
|
|
||||||
|
|
||||||
return ((reference_time.value() + static_cast<std::uint64_t>(delay)) <=
|
return ((reference_time.value() + static_cast<std::uint64_t>(delay)) <=
|
||||||
utils::time::get_time_now());
|
utils::time::get_time_now());
|
||||||
}
|
}
|
||||||
@ -108,29 +97,18 @@ void eviction::service_function() {
|
|||||||
while (not get_stop_requested() && should_evict &&
|
while (not get_stop_requested() && should_evict &&
|
||||||
not cached_files_list.empty()) {
|
not cached_files_list.empty()) {
|
||||||
try {
|
try {
|
||||||
event_system::instance().raise<debug_log>(std::string{function_name},
|
|
||||||
cached_files_list.front(),
|
|
||||||
"analyzing0");
|
|
||||||
std::string api_path;
|
std::string api_path;
|
||||||
if (provider_.get_api_path_from_source(
|
if (provider_.get_api_path_from_source(
|
||||||
cached_files_list.front(), api_path) == api_error::success) {
|
cached_files_list.front(), api_path) == api_error::success) {
|
||||||
event_system::instance().raise<debug_log>(std::string{function_name},
|
|
||||||
api_path, "analyzing1");
|
|
||||||
api_file file{};
|
api_file file{};
|
||||||
filesystem_item fsi{};
|
filesystem_item fsi{};
|
||||||
if (provider_.get_filesystem_item_and_file(api_path, file, fsi) ==
|
if (provider_.get_filesystem_item_and_file(api_path, file, fsi) ==
|
||||||
api_error::success) {
|
api_error::success) {
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, api_path, "analyzing2");
|
|
||||||
// Only evict files that match expected size
|
// Only evict files that match expected size
|
||||||
auto opt_size = utils::file::file{cached_files_list.front()}.size();
|
auto opt_size = utils::file::file{cached_files_list.front()}.size();
|
||||||
if (opt_size.has_value()) {
|
if (opt_size.has_value()) {
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, api_path, "analyzing3");
|
|
||||||
auto file_size{opt_size.value()};
|
auto file_size{opt_size.value()};
|
||||||
if (file_size == fsi.size) {
|
if (file_size == fsi.size) {
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, api_path, "analyzing4");
|
|
||||||
// Try to evict file
|
// Try to evict file
|
||||||
if (fm_.evict_file(fsi.api_path) &&
|
if (fm_.evict_file(fsi.api_path) &&
|
||||||
config_.get_enable_max_cache_size()) {
|
config_.get_enable_max_cache_size()) {
|
||||||
|
@ -191,21 +191,15 @@ auto file_manager::evict_file(const std::string &api_path) -> bool {
|
|||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
if (provider_.is_read_only()) {
|
if (provider_.is_read_only()) {
|
||||||
event_system::instance().raise<debug_log>(std::string{function_name},
|
|
||||||
api_path, "read only");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
recur_mutex_lock open_lock(open_file_mtx_);
|
recur_mutex_lock open_lock(open_file_mtx_);
|
||||||
if (is_processing(api_path)) {
|
if (is_processing(api_path)) {
|
||||||
event_system::instance().raise<debug_log>(std::string{function_name},
|
|
||||||
api_path, "processing");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_open_file_count(api_path) != 0U) {
|
if (get_open_file_count(api_path) != 0U) {
|
||||||
event_system::instance().raise<debug_log>(std::string{function_name},
|
|
||||||
api_path, "open count");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,8 +212,6 @@ auto file_manager::evict_file(const std::string &api_path) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (not pinned.empty() && utils::string::to_bool(pinned)) {
|
if (not pinned.empty() && utils::string::to_bool(pinned)) {
|
||||||
event_system::instance().raise<debug_log>(std::string{function_name},
|
|
||||||
api_path, "pinned");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user