From bf3a4e36e673423cadfa9a162abda779dc3ea155 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Tue, 23 Sep 2025 17:40:27 -0700 Subject: [PATCH 1/3] container: lib_reports: optimize writes by forking - Decreases real time in multicore container environments. * Given the nature of the writer, there should be no race conditions. --- container/src/finance/lib/internal/lib_reports.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/container/src/finance/lib/internal/lib_reports.bash b/container/src/finance/lib/internal/lib_reports.bash index c09573f..91e0258 100644 --- a/container/src/finance/lib/internal/lib_reports.bash +++ b/container/src/finance/lib/internal/lib_reports.bash @@ -342,12 +342,13 @@ function lib_reports::__reports() lib_utils::print_custom " \e[32m├─\e[34m\e[1;3m ${_new_echo}\e[0m\n" - lib_reports::__reports_write \ + (lib_reports::__reports_write \ "$_type" \ "$_new_desc" \ "$_new_base_file" \ - "${_new_opts[@]}" + "${_new_opts[@]}") & done + wait lib_utils::print_custom " \e[32m│\e[0m\n" done From 66c34a4b1c5cc0fd924165257492f97e17956ec2 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Tue, 23 Sep 2025 18:09:06 -0700 Subject: [PATCH 2/3] container: lib_taxes: optimize writes by forking - Decreases real time in multicore container environments. * Given the nature of the writer, there should be no race conditions. --- container/src/finance/lib/internal/lib_taxes.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/container/src/finance/lib/internal/lib_taxes.bash b/container/src/finance/lib/internal/lib_taxes.bash index bb6a3c6..292b4cc 100644 --- a/container/src/finance/lib/internal/lib_taxes.bash +++ b/container/src/finance/lib/internal/lib_taxes.bash @@ -1036,6 +1036,7 @@ function lib_taxes::__taxes_write() # Generate transparent (full) reports local _ext_full="report_full.csv" for _arg_tag in "${global_arg_tag[@]}"; do + ( lib_utils::print_custom " \e[32m├─\e[34m\e[1;3m ${_arg_tag} (full)\e[0m\n" local _base_path="${_tax_root_dir}/${_arg_tag}/${_tax_year}_${_arg_tag}" @@ -1047,7 +1048,9 @@ function lib_taxes::__taxes_write() if [[ ! -f "$_out_file" || ! -s "$_out_file" ]]; then lib_utils::print_warning "Nothing generated for '${_arg_tag}' (no taxable event found for the year ${global_arg_year})" fi + ) & done + wait # Patch transparent (full) reports # WARNING: depends on previous base path / extension format # TODO: no, not this way From 2f293ed56600c6741883ee8fbc2f804a7907def5 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Thu, 2 Oct 2025 17:19:21 -0700 Subject: [PATCH 3/3] container: lib_taxes: run linter --- .../src/finance/lib/internal/lib_taxes.bash | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/container/src/finance/lib/internal/lib_taxes.bash b/container/src/finance/lib/internal/lib_taxes.bash index 292b4cc..5a0b41f 100644 --- a/container/src/finance/lib/internal/lib_taxes.bash +++ b/container/src/finance/lib/internal/lib_taxes.bash @@ -1036,19 +1036,19 @@ function lib_taxes::__taxes_write() # Generate transparent (full) reports local _ext_full="report_full.csv" for _arg_tag in "${global_arg_tag[@]}"; do - ( - lib_utils::print_custom " \e[32m├─\e[34m\e[1;3m ${_arg_tag} (full)\e[0m\n" + ( + lib_utils::print_custom " \e[32m├─\e[34m\e[1;3m ${_arg_tag} (full)\e[0m\n" - local _base_path="${_tax_root_dir}/${_arg_tag}/${_tax_year}_${_arg_tag}" - local _out_file="${_base_path}-${_ext_full}" + local _base_path="${_tax_root_dir}/${_arg_tag}/${_tax_year}_${_arg_tag}" + local _out_file="${_base_path}-${_ext_full}" - lib_taxes::__taxes_print "$_tax_year" "$_arg_tag" >"${_out_file}" - lib_utils::catch $? + lib_taxes::__taxes_print "$_tax_year" "$_arg_tag" >"${_out_file}" + lib_utils::catch $? - if [[ ! -f "$_out_file" || ! -s "$_out_file" ]]; then - lib_utils::print_warning "Nothing generated for '${_arg_tag}' (no taxable event found for the year ${global_arg_year})" - fi - ) & + if [[ ! -f "$_out_file" || ! -s "$_out_file" ]]; then + lib_utils::print_warning "Nothing generated for '${_arg_tag}' (no taxable event found for the year ${global_arg_year})" + fi + ) & done wait