diff --git a/server/src/services/analytic_service/analytic_service.rs b/server/src/services/analytic_service/analytic_service.rs index 94824da..04751bf 100644 --- a/server/src/services/analytic_service/analytic_service.rs +++ b/server/src/services/analytic_service/analytic_service.rs @@ -245,6 +245,9 @@ impl AnalyticService { .set_last_detection(id, timestamp) .unwrap(); } + ResponseType::DetectionRunnerDetection(from, to) => { + println!("detection: {} {}", from, to); + } ResponseType::LearningStarted => { self.analytic_unit_learning_status = LearningStatus::Learning } diff --git a/server/src/services/analytic_service/detection_runner.rs b/server/src/services/analytic_service/detection_runner.rs index 6d9b3e8..f9aff4e 100644 --- a/server/src/services/analytic_service/detection_runner.rs +++ b/server/src/services/analytic_service/detection_runner.rs @@ -69,7 +69,15 @@ impl DetectionRunner { let detections = a.detect(ms.clone(), t_from, t_to).await.unwrap(); for d in detections { - println!("detection: {} {}", d.0, d.1); + match tx + .send(AnalyticServiceMessage::Response(Ok( + ResponseType::DetectionRunnerDetection(d.0, d.1), + ))) + .await + { + Ok(_) => {} + Err(_e) => println!("Fail to send detection runner detection notification"), + } } // TODO: send info about detections to tx diff --git a/server/src/services/analytic_service/types.rs b/server/src/services/analytic_service/types.rs index 527ede7..0f551d9 100644 --- a/server/src/services/analytic_service/types.rs +++ b/server/src/services/analytic_service/types.rs @@ -45,6 +45,7 @@ impl Default for LearningTrain { pub enum ResponseType { DetectionRunnerStarted(u64), DetectionRunnerUpdate(String, u64), // analytic_unit id and timestamp + DetectionRunnerDetection(u64, u64), // TODO: add more into about analytic unit and more LearningStarted, LearningFinished(Box), LearningFinishedEmpty,