summaryrefslogtreecommitdiffstats
path: root/ml/ml.cc
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-01-11 17:45:25 +0200
committerGitHub <noreply@github.com>2023-01-11 17:45:25 +0200
commitb00b62f0e784b5eb616868c60985292cb3a7239d (patch)
tree68f0475ef1f35ef06d596631ac67aa31dfb919d6 /ml/ml.cc
parentdb0eb4556d435c264210a7e9dbfe69cb016ef456 (diff)
cancel ml threads on shutdown and join them on host free (#14240)
* cancel ml threads on shutdown and join them on host free * mark them not running before joining them
Diffstat (limited to 'ml/ml.cc')
-rw-r--r--ml/ml.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/ml/ml.cc b/ml/ml.cc
index 2a0df8867c..461c83baae 100644
--- a/ml/ml.cc
+++ b/ml/ml.cc
@@ -156,7 +156,14 @@ void ml_start_anomaly_detection_threads(RRDHOST *RH) {
void ml_stop_anomaly_detection_threads(RRDHOST *RH) {
if (RH && RH->ml_host) {
Host *H = reinterpret_cast<Host *>(RH->ml_host);
- H->stopAnomalyDetectionThreads();
+ H->stopAnomalyDetectionThreads(true);
+ }
+}
+
+void ml_cancel_anomaly_detection_threads(RRDHOST *RH) {
+ if (RH && RH->ml_host) {
+ Host *H = reinterpret_cast<Host *>(RH->ml_host);
+ H->stopAnomalyDetectionThreads(false);
}
}