Update likwidMetric.go

Fixes a potential bug when `fsnotify.NewWatcher()` fails with an error
This commit is contained in:
Thomas Gruber 2023-08-18 11:27:47 +02:00 committed by GitHub
parent e425b2c38e
commit fc19b2b9a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -344,6 +344,7 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
watcher, err := fsnotify.NewWatcher()
if err != nil {
cclog.ComponentError(m.name, err.Error())
return true, err
}
defer watcher.Close()
if len(m.config.LockfilePath) > 0 {