Improve CPU usage by invoking task less often

Only invoke task to export tasks data when pending.data taskwarrior file has changed.

This reduces CPU usage when idle from 50% to 2% on my system.
This commit is contained in:
desbma 2021-03-01 01:26:37 +01:00
parent 3ad7c46c77
commit dc2ee91b7e
4 changed files with 58 additions and 4 deletions

View file

@ -37,6 +37,7 @@ pub struct Config {
pub enabled: bool,
pub color: HashMap<String, Style>,
pub filter: String,
pub data_location: String,
pub obfuscate: bool,
pub print_empty_columns: bool,
pub due: usize,
@ -62,6 +63,7 @@ impl Config {
print_empty_columns: bool_collection.get("print_empty_columns").cloned().unwrap_or(false),
color: Self::get_color_collection()?,
filter: Self::get_filter(),
data_location: Self::get_data_location(),
due: Self::get_due(),
rule_precedence_color: Self::get_rule_precedence_color(),
uda_task_report_show_info: Self::get_uda_task_report_show_info(),
@ -296,6 +298,10 @@ impl Config {
Self::get_config("report.next.filter")
}
fn get_data_location() -> String {
Self::get_config("data.location")
}
fn get_uda_task_report_show_info() -> bool {
Self::get_config("uda.taskwarrior-tui.task-report.show-info")
.get_bool()