diff --git a/client/src/components/Graph.vue b/client/src/components/Graph.vue index 49f7b11..46837bb 100644 --- a/client/src/components/Graph.vue +++ b/client/src/components/Graph.vue @@ -5,7 +5,7 @@ diff --git a/server/src/services/analytic_service/analytic_service.rs b/server/src/services/analytic_service/analytic_service.rs index d805127..e9dd6e3 100644 --- a/server/src/services/analytic_service/analytic_service.rs +++ b/server/src/services/analytic_service/analytic_service.rs @@ -109,6 +109,7 @@ impl AnalyticService { // })); // } + // TODO: maybe make `consume_request` async fn consume_request(&mut self, req: types::RequestType) -> () { match req { RequestType::RunLearning => { @@ -168,14 +169,13 @@ impl AnalyticService { tx.send(self.analytic_unit_config.clone()).unwrap(); } RequestType::PatchConfig(patch_obj, tx) => { - // TODO: path config - // TODO: run learning if config type changed - self.patch_config(patch_obj); - tx.send(()).unwrap(); + self.patch_config(patch_obj, tx); + // tx.send(()).unwrap(); } }; } - + + // TODO: maybe make `consume_response` async fn consume_response(&mut self, res: types::ResponseType) { match res { // TODO: handle when learning panic @@ -214,11 +214,18 @@ impl AnalyticService { } } - fn patch_config(&mut self, patch: PatchConfig) { + fn patch_config(&mut self, patch: PatchConfig, tx: oneshot::Sender<()>) { let (new_conf, need_learning) = self.analytic_unit_config.patch(patch); self.analytic_unit_config = new_conf; if need_learning { self.consume_request(RequestType::RunLearning); + // TODO: it's not fullu correct: we need to wait when the learning starts + match tx.send(()) { + Ok(_) => {}, + Err(_e) => { + println!("Can`t send patch config notification"); + } + } } else { if self.analytic_unit.is_some() { tokio::spawn({ @@ -226,8 +233,21 @@ impl AnalyticService { let cfg = self.analytic_unit_config.clone(); async move { au.unwrap().write().await.set_config(cfg); + match tx.send(()) { + Ok(_) => {}, + Err(_e) => { + println!("Can`t send patch config notification"); + } + } } }); + } else { + match tx.send(()) { + Ok(_) => {}, + Err(_e) => { + println!("Can`t send patch config notification"); + } + } } } } diff --git a/server/src/services/analytic_service/analytic_unit/types.rs b/server/src/services/analytic_service/analytic_unit/types.rs index 05b2291..3ef8972 100644 --- a/server/src/services/analytic_service/analytic_unit/types.rs +++ b/server/src/services/analytic_service/analytic_unit/types.rs @@ -17,7 +17,7 @@ impl Default for PatternConfig { fn default() -> Self { PatternConfig { correlation_score: 0.7, - anti_correlation_score: 0.7, + anti_correlation_score: 0.1, model_score: 0.5, threshold_score: 1.0, }