mirror of
https://git.alemi.dev/dashboard.git
synced 2024-11-22 07:24:52 +01:00
fix: remove exit delay in gui mode, unused imports
This commit is contained in:
parent
37fd0cda94
commit
54c61130f6
2 changed files with 13 additions and 7 deletions
|
@ -1,7 +1,5 @@
|
||||||
//! SeaORM Entity. Generated by sea-orm-codegen 0.10.1
|
//! SeaORM Entity. Generated by sea-orm-codegen 0.10.1
|
||||||
|
|
||||||
use chrono::Utc;
|
|
||||||
use eframe::egui::plot::PlotPoint;
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
|
|
||||||
use crate::data::FetchError;
|
use crate::data::FetchError;
|
||||||
|
|
18
src/main.rs
18
src/main.rs
|
@ -178,15 +178,23 @@ fn main() {
|
||||||
.block_on(async {
|
.block_on(async {
|
||||||
let mut jobs = vec![];
|
let mut jobs = vec![];
|
||||||
|
|
||||||
let run_rx_clone_clone = run_rx.clone();
|
let mut run_rx_clone_clone = run_rx.clone();
|
||||||
|
|
||||||
jobs.push(
|
jobs.push(
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
while *run_rx_clone_clone.borrow() {
|
loop {
|
||||||
if let Some(ctx) = &*ctx_rx.borrow() {
|
// TODO probably state-worker can request a repaint directly, if we pass the
|
||||||
ctx.request_repaint();
|
// channel used to receive ctx
|
||||||
|
tokio::select!{ // block on `run` too so that application can exit quickly
|
||||||
|
_ = run_rx_clone_clone.changed() => {
|
||||||
|
if ! *run_rx_clone_clone.borrow() { break; }
|
||||||
|
},
|
||||||
|
_ = tokio::time::sleep(std::time::Duration::from_secs(args.interval)) => {
|
||||||
|
if let Some(ctx) = &*ctx_rx.borrow() {
|
||||||
|
ctx.request_repaint();
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
tokio::time::sleep(std::time::Duration::from_secs(args.interval)).await;
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue