Browse Source

better print for detection runner

detection_runner_updade
Alexey Velikiy 2 years ago
parent
commit
2c465fa5c6
  1. 2
      server/src/services/analytic_service/analytic_service.rs
  2. 5
      server/src/services/analytic_service/detection_runner.rs

2
server/src/services/analytic_service/analytic_service.rs

@ -114,14 +114,12 @@ impl AnalyticService {
// TODO: make // TODO: make
fn run_detection_runner(&mut self, from: u64) { fn run_detection_runner(&mut self, from: u64) {
println!("run_detection_runner");
// TODO: handle case or make it impossible to run_detection_runner second time // TODO: handle case or make it impossible to run_detection_runner second time
if self.analytic_unit_learning_status != LearningStatus::Ready { if self.analytic_unit_learning_status != LearningStatus::Ready {
let task = DetectionRunnerTask { let task = DetectionRunnerTask {
from from
}; };
println!("add learning waiter");
self.learning_waiters.push(LearningWaiter::DetectionRunner(task)); self.learning_waiters.push(LearningWaiter::DetectionRunner(task));
return; return;
} }

5
server/src/services/analytic_service/detection_runner.rs

@ -27,7 +27,6 @@ impl DetectionRunner {
pub fn run(&mut self, from: u64) { pub fn run(&mut self, from: u64) {
// TODO: get last detection timestamp from persistance // TODO: get last detection timestamp from persistance
// TODO: set last detection from "now" // TODO: set last detection from "now"
println!("Run begn");
if self.running_handler.is_some() { if self.running_handler.is_some() {
self.running_handler.as_mut().unwrap().abort(); self.running_handler.as_mut().unwrap().abort();
} }
@ -40,9 +39,9 @@ impl DetectionRunner {
// TODO: define window for detection // TODO: define window for detection
// TODO: save last detection // TODO: save last detection
println!("detection runner started from {}", from);
loop { loop {
println!("runner detect");
// TODO: run detection periodically // TODO: run detection periodically
sleep(Duration::from_secs(cfg.interval)).await; sleep(Duration::from_secs(cfg.interval)).await;
} }

Loading…
Cancel
Save