brd listener for cli - cli ini only after config pull from brd ??
parent
5c94e366eb
commit
df3934452b
|
|
@ -29,6 +29,8 @@ async fn main() -> anyhow::Result<()>{
|
||||||
info!("Noxis is configurating...");
|
info!("Noxis is configurating...");
|
||||||
//
|
//
|
||||||
let (tx_brd, mut rx_brd) = broadcast::channel::<Processes>(1);
|
let (tx_brd, mut rx_brd) = broadcast::channel::<Processes>(1);
|
||||||
|
// for cli to get config
|
||||||
|
let mut rx_cli_brd = tx_brd.subscribe();
|
||||||
// cli <-> config
|
// cli <-> config
|
||||||
let (tx_oneshot, rx_oneshot) = oneshot::channel::<Processes>();
|
let (tx_oneshot, rx_oneshot) = oneshot::channel::<Processes>();
|
||||||
let mut handler: Vec<tokio::task::JoinHandle<()>> = vec![];
|
let mut handler: Vec<tokio::task::JoinHandle<()>> = vec![];
|
||||||
|
|
@ -47,7 +49,17 @@ async fn main() -> anyhow::Result<()>{
|
||||||
// initilaizing task for cli manipulation
|
// initilaizing task for cli manipulation
|
||||||
let preboot_cli = preboot.clone();
|
let preboot_cli = preboot.clone();
|
||||||
let cli_module = tokio::spawn(async move {
|
let cli_module = tokio::spawn(async move {
|
||||||
if let Err(er) = init_cli_pipeline(preboot_cli).await {
|
let config = {
|
||||||
|
let mut tick = tokio::time::interval(Duration::from_millis(500));
|
||||||
|
loop {
|
||||||
|
tick.tick().await;
|
||||||
|
break match rx_cli_brd.try_recv() {
|
||||||
|
Ok(conf) => conf,
|
||||||
|
Err(_) => continue,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if let Err(er) = init_cli_pipeline(preboot_cli, Arc::new(config)).await {
|
||||||
error!("CLI pipeline failed due to {}", er)
|
error!("CLI pipeline failed due to {}", er)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue