removed debug logs

This commit is contained in:
2025-01-25 06:01:00 -06:00
parent f7b829f71c
commit 7c8b44bf69

View File

@ -24,7 +24,6 @@
#include "app_config.hpp" #include "app_config.hpp"
#include "db/meta_db.hpp" #include "db/meta_db.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/debug_log.hpp"
#include "events/types/directory_remove_failed.hpp" #include "events/types/directory_remove_failed.hpp"
#include "events/types/directory_removed.hpp" #include "events/types/directory_removed.hpp"
#include "events/types/directory_removed_externally.hpp" #include "events/types/directory_removed_externally.hpp"
@ -58,8 +57,6 @@ void base_provider::add_all_items(stop_type &stop_requested) {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<debug_log>(function_name, "get list|begin");
api_file_list list{}; api_file_list list{};
std::string marker; std::string marker;
auto res{api_error::more_data}; auto res{api_error::more_data};
@ -69,9 +66,6 @@ void base_provider::add_all_items(stop_type &stop_requested) {
utils::error::raise_error(function_name, res, "failed to get file list"); utils::error::raise_error(function_name, res, "failed to get file list");
} }
} }
event_system::instance().raise<debug_log>(
function_name, fmt::format("get list|end|{}", list.size()));
} }
auto base_provider::create_api_file(std::string path, std::string key, auto base_provider::create_api_file(std::string path, std::string key,
@ -561,14 +555,8 @@ void base_provider::process_removed_items(stop_type &stop_requested) {
return stop_requested || app_config::get_stop_requested(); return stop_requested || app_config::get_stop_requested();
}; };
event_system::instance().raise<debug_log>(function_name,
"checking removed items");
db3_->enumerate_api_path_list( db3_->enumerate_api_path_list(
[this, &get_stop_requested](auto &&list) { [this, &get_stop_requested](auto &&list) {
event_system::instance().raise<debug_log>(
function_name,
fmt::format("enumerating removed items|{}", list.size()));
[[maybe_unused]] auto res = [[maybe_unused]] auto res =
std::all_of(list.begin(), list.end(), [&](auto &&api_path) -> bool { std::all_of(list.begin(), list.end(), [&](auto &&api_path) -> bool {
if (get_stop_requested()) { if (get_stop_requested()) {
@ -577,44 +565,23 @@ void base_provider::process_removed_items(stop_type &stop_requested) {
tasks::instance().schedule({ tasks::instance().schedule({
[this, api_path](auto &&task_stopped) { [this, api_path](auto &&task_stopped) {
event_system::instance().raise<debug_log>(
function_name,
fmt::format("checking item|{}", api_path));
api_meta_map meta{}; api_meta_map meta{};
auto result = get_item_meta(api_path, meta); auto result = get_item_meta(api_path, meta);
if (result != api_error::success) { if (result != api_error::success) {
event_system::instance().raise<debug_log>(
function_name,
fmt::format("meta not found|{}|error|{}", api_path,
api_error_to_string(result)));
return; return;
} }
if (utils::string::to_bool(meta[META_DIRECTORY])) { if (utils::string::to_bool(meta[META_DIRECTORY])) {
event_system::instance().raise<debug_log>(
function_name,
fmt::format("checking directory|{}", api_path));
bool exists{}; bool exists{};
if (is_directory(api_path, exists) != if (is_directory(api_path, exists) !=
api_error::success) { api_error::success) {
return; return;
} }
event_system::instance().raise<debug_log>(
function_name,
fmt::format("checking directory|{}|exists|{}",
api_path, exists));
if (exists) { if (exists) {
return; return;
} }
event_system::instance().raise<debug_log>(
function_name,
fmt::format(
"processing removed directory|{}|exists|{}",
api_path, exists));
process_removed_directories( process_removed_directories(
{ {
removed_item{api_path, true, ""}, removed_item{api_path, true, ""},
@ -624,26 +591,15 @@ void base_provider::process_removed_items(stop_type &stop_requested) {
return; return;
} }
event_system::instance().raise<debug_log>(
function_name,
fmt::format("checking file|{}", api_path));
bool exists{}; bool exists{};
if (is_file(api_path, exists) != api_error::success) { if (is_file(api_path, exists) != api_error::success) {
return; return;
} }
event_system::instance().raise<debug_log>(
function_name, fmt::format("checking file|{}|exists|{}",
api_path, exists));
if (exists) { if (exists) {
return; return;
} }
event_system::instance().raise<debug_log>(
function_name,
fmt::format("processing removed file|{}|exists|{}",
api_path, exists));
process_removed_files( process_removed_files(
{ {
removed_item{api_path, false, meta[META_SOURCE]}, removed_item{api_path, false, meta[META_SOURCE]},
@ -665,19 +621,16 @@ void base_provider::remove_deleted_items(stop_type &stop_requested) {
return stop_requested || app_config::get_stop_requested(); return stop_requested || app_config::get_stop_requested();
}; };
event_system::instance().raise<debug_log>(function_name, "add all");
add_all_items(stop_requested); add_all_items(stop_requested);
if (get_stop_requested()) { if (get_stop_requested()) {
return; return;
} }
event_system::instance().raise<debug_log>(function_name, "remove unmatched");
remove_unmatched_source_files(stop_requested); remove_unmatched_source_files(stop_requested);
if (get_stop_requested()) { if (get_stop_requested()) {
return; return;
} }
event_system::instance().raise<debug_log>(function_name, "remove items");
process_removed_items(stop_requested); process_removed_items(stop_requested);
} }