Skip to content

Commit

Permalink
tweak: Don't show "ERROR" permanently if we can recover
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Jul 30, 2024
1 parent 2d17510 commit 1542802
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ fn run() -> anyhow::Result<()> {
));

tasks.set_tasks(intro::get_setup_tasks(wifi.is_connected().unwrap_or(false)));
let mut last_update = chrono::Local::now();

loop {
let is_online = wifi.is_connected()?;
Expand All @@ -128,11 +129,13 @@ fn run() -> anyhow::Result<()> {
log::info!("Got {} tasks from Todoist", t.len());
tasks.set_tasks(t);
if tasks.is_dirty() {
header.set_last_update(
format!("Updated at {}", chrono::Local::now().format("%H:%M")),
OctColor::Green,
);
last_update = chrono::Local::now();
}

header.set_last_update(
format!("Updated at {}", last_update.format("%H:%M")),
OctColor::Green,
);
}
Err(e) => {
log::error!("Failed to get tasks from Todoist: {:?}", e);
Expand Down

0 comments on commit 1542802

Please sign in to comment.