mirror of
https://github.com/prometheus-community/windows_exporter
synced 2025-02-21 14:46:54 +00:00
fix(#1352): moving the stop signal after svc.Run()
Signed-off-by: Dinifarb <andreas.vogt89@bluewin.ch>
This commit is contained in:
parent
971cab5184
commit
44f4918219
@ -13,9 +13,7 @@ const (
|
||||
serviceName = "windows_exporter"
|
||||
)
|
||||
|
||||
type windowsExporterService struct {
|
||||
stopCh chan<- bool
|
||||
}
|
||||
type windowsExporterService struct{}
|
||||
|
||||
var logger *eventlog.Log
|
||||
|
||||
@ -39,7 +37,6 @@ loop:
|
||||
}
|
||||
}
|
||||
}
|
||||
s.stopCh <- true
|
||||
return
|
||||
}
|
||||
|
||||
@ -63,10 +60,13 @@ func init() {
|
||||
}
|
||||
_ = logger.Info(100, "Attempting to start exporter service")
|
||||
go func() {
|
||||
err = svc.Run(serviceName, &windowsExporterService{stopCh: StopCh})
|
||||
err = svc.Run(serviceName, &windowsExporterService{})
|
||||
if err != nil {
|
||||
_ = logger.Error(102, fmt.Sprintf("Failed to start service: %v", err))
|
||||
}
|
||||
defer func() {
|
||||
StopCh <- true
|
||||
}()
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user