Compare commits
No commits in common. "ab75252e6b9a7846ded0a42f186f5eacddd196fb" and "a225ec690ee146cb2509c6c58bc149b7810c72c0" have entirely different histories.
ab75252e6b
...
a225ec690e
|
|
@ -21,7 +21,6 @@ async fn main() -> Result<()>{
|
||||||
// config update channel
|
// config update channel
|
||||||
let (tx, mut rx) = mpsc::channel::<ApiConfig>(1);
|
let (tx, mut rx) = mpsc::channel::<ApiConfig>(1);
|
||||||
// futures
|
// futures
|
||||||
// todo : rewrite with spawn
|
|
||||||
let config_fut = init_config_grub_mechanism(&tx);
|
let config_fut = init_config_grub_mechanism(&tx);
|
||||||
let grub_fut = init_api_grub_mechanism(config, &mut rx);
|
let grub_fut = init_api_grub_mechanism(config, &mut rx);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use anyhow::{Error, Result};
|
use anyhow::{Error, Result};
|
||||||
use integr_structs::api::ApiConfig;
|
use integr_structs::api::ApiConfig;
|
||||||
use tokio::time::{sleep, Duration};
|
use tokio::time::{sleep, Instant};
|
||||||
use tokio::net::UnixStream;
|
use tokio::net::UnixStream;
|
||||||
use std::env;
|
use std::env;
|
||||||
use tokio::sync::mpsc::Receiver;
|
use tokio::sync::mpsc::Receiver;
|
||||||
|
|
@ -31,16 +31,15 @@ pub async fn init_delivery_mech(rx: ConfigGateway) -> Result<()> {
|
||||||
match UnixSocketConsumer::ApiGrubber.get_stream_object().await {
|
match UnixSocketConsumer::ApiGrubber.get_stream_object().await {
|
||||||
Ok(socket) => {
|
Ok(socket) => {
|
||||||
socket.try_write(to_string_pretty(&config)?.as_bytes())?;
|
socket.try_write(to_string_pretty(&config)?.as_bytes())?;
|
||||||
info!("New api config was pulled");
|
|
||||||
},
|
},
|
||||||
Err(er) => {
|
Err(er) => {
|
||||||
error!("Cannot coonect to ApiGrubber Unix-Socket due to {er}");
|
error!("Cannot coonect to ApiGrubber Unix-Socket due to {er}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sleep(Duration::from_secs(3)).await;
|
|
||||||
}
|
}
|
||||||
// let api_sock = UnixSocketConsumer::ApiGrubber.get_stream_object().await?;
|
// let api_sock = UnixSocketConsumer::ApiGrubber.get_stream_object().await?;
|
||||||
// let preproc_sock = UnixSocketConsumer::Preproc.get_stream_object().await?;
|
// let preproc_sock = UnixSocketConsumer::Preproc.get_stream_object().await?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnixSocketConsumer {
|
impl UnixSocketConsumer {
|
||||||
|
|
@ -53,13 +52,12 @@ impl UnixSocketConsumer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// async fn check_unix_socket_file(path: &str) -> bool {
|
async fn check_unix_socket_file(path: &str) -> bool {
|
||||||
// std::path::Path::new(path).exists()
|
std::path::Path::new(path).exists()
|
||||||
// }
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(tests)]
|
||||||
mod delivery_unittests {
|
mod delivery_unittests {
|
||||||
#[allow(unused_imports)]
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use tokio::test;
|
use tokio::test;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ use tokio::sync::mpsc;
|
||||||
use log::{info, error};
|
use log::{info, error};
|
||||||
use integration::init_integration_mech;
|
use integration::init_integration_mech;
|
||||||
use delivery::init_delivery_mech;
|
use delivery::init_delivery_mech;
|
||||||
|
use tokio::task::JoinHandle;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
// Arch :
|
// Arch :
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"id" : 1 ,
|
|
||||||
"template" :
|
|
||||||
[{
|
|
||||||
"id" :"conference",
|
|
||||||
"name" : "Conference",
|
|
||||||
"url" : "https://$ip_address/api/v1/conferences",
|
|
||||||
"measure" :
|
|
||||||
[
|
|
||||||
"total", "number", "description",
|
|
||||||
"shutdown", "startTime", "stopTime",
|
|
||||||
"participants_total", "participants_online"
|
|
||||||
]
|
|
||||||
}],
|
|
||||||
"ip_address" : "127.0.0.1:8081",
|
|
||||||
"login" : "",
|
|
||||||
"pass" : "" ,
|
|
||||||
"api_key" : "908c709827bd40n98r7209837x98273",
|
|
||||||
"period" : "10",
|
|
||||||
"timeout" : "2"
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue