Skip to content

Commit

Permalink
chore: sleep 1s between trying shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyc committed Mar 20, 2024
1 parent d7baefa commit b5e486a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pisugar-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async fn poll_pisugar_status(core: &mut PiSugarCore, tx: &EventTx) {
let now = Instant::now();
match core.poll(now).await {
Ok(Some(tap_type)) => {
let _ = tx.send(format!("{}", tap_type));
let _ = tx.send(format!("{}\n", tap_type));
}
Err(e) => {
log::debug!("Poll error: {}", e);
Expand Down Expand Up @@ -1311,6 +1311,7 @@ async fn main() -> std::io::Result<()> {
.clone()
.unwrap_or_else(|| "shutdown --poweroff 0".to_string());
let _ = execute_shell(&shell);
tokio::time::sleep(Duration::from_secs(1)).await;
}
}
}

0 comments on commit b5e486a

Please sign in to comment.