From d368962815331b8ec69c97a3e357949258ebad85 Mon Sep 17 00:00:00 2001 From: kulukami Date: Mon, 2 Dec 2024 19:13:15 +0800 Subject: [PATCH] fix drop task without finished flag --- plugins/scanner/src/detector.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins/scanner/src/detector.rs b/plugins/scanner/src/detector.rs index 34eec712c..2b34cc6f5 100644 --- a/plugins/scanner/src/detector.rs +++ b/plugins/scanner/src/detector.rs @@ -357,6 +357,18 @@ impl Detector { t.get_token(), t.get_data() ); + let end_flag = ScanFinished { + data: "failed".to_string(), + error: format!( + "scanner task chan is full with {:?}", + task_sender.len() + ), + }; + if let Err(e) = r_client + .send_record(&end_flag.to_record_token(&t.get_token())) + { + warn!("send err, should exit : {:?}", e); + }; continue; } let task_map: HashMap = @@ -368,6 +380,11 @@ impl Detector { data: "failed".to_string(), error: format!("recv serde_json err {:?}", t.data), }; + if let Err(e) = r_client + .send_record(&end_flag.to_record_token(&t.get_token())) + { + warn!("send err, should exit : {:?}", e); + }; continue; } }; @@ -453,7 +470,7 @@ impl Detector { }; break; */ - warn!("walkdir err, should continue: {:?}", _err); + warn!("walkdir continue with: {:?}", _err); continue } Some(Ok(entry)) => entry,