From c168e1e9fcb63fbb299cf9aa499927e96c0389ba Mon Sep 17 00:00:00 2001
From: Pablo Garcia Alvarez
Date: Mon, 11 Nov 2024 22:07:57 +0100
Subject: [PATCH] Add check for the wait
---
collector/pkg/collector/metrics.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/collector/pkg/collector/metrics.go b/collector/pkg/collector/metrics.go
index 5ae3364..7ff4fc8 100644
--- a/collector/pkg/collector/metrics.go
+++ b/collector/pkg/collector/metrics.go
@@ -91,7 +91,9 @@ func (mc *MetricsCollector) Run() error {
//go mc.Collect(&wg, device.WWN, device.DeviceName, device.DeviceType)
mc.Collect(device.WWN, device.DeviceName, device.DeviceType)
- time.Sleep(time.Duration(mc.config.GetInt("commands.metrics_smartctl_wait")) * time.Millisecond)
+ if mc.config.GetInt("commands.metrics_smartctl_wait") > 0 {
+ time.Sleep(time.Duration(mc.config.GetInt("commands.metrics_smartctl_wait")) * time.Millisecond)
+ }
}
//mc.logger.Infoln("Main: Waiting for workers to finish")