spawn on local set
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m54s
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m54s
This commit is contained in:
parent
7f4a880720
commit
9d9755515d
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2633,7 +2633,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tesla-charge-controller"
|
||||
version = "1.0.30"
|
||||
version = "1.0.31"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap 4.4.11",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "tesla-charge-controller"
|
||||
version = "1.0.30"
|
||||
version = "1.0.31"
|
||||
edition = "2021"
|
||||
license = "MITNFA"
|
||||
description = "Controls Tesla charge rate based on solar charge data"
|
||||
|
|
|
@ -108,7 +108,7 @@ async fn main() {
|
|||
None
|
||||
}
|
||||
};
|
||||
|
||||
let local = tokio::task::LocalSet::new();
|
||||
// spawn a loop for each additional charge controller to log
|
||||
// failed connections will print an error but the program will continue
|
||||
let _additional_controllers: Vec<_> = access_config()
|
||||
|
@ -141,7 +141,7 @@ async fn main() {
|
|||
} => Tristar::new(serial_port.clone(), baud_rate)
|
||||
.some_or_print_with("Failed to connect to additional Tristar")
|
||||
.map(|mut tristar| {
|
||||
tokio::task::spawn_local(async move {
|
||||
local.spawn_local(async move {
|
||||
let mut interval = tokio::time::interval(
|
||||
std::time::Duration::from_secs(watch_interval_seconds),
|
||||
);
|
||||
|
@ -219,8 +219,7 @@ async fn main() {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
server_handle.await;
|
||||
tokio::join!(server_handle, local);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue