Skip to content

Commit

Permalink
fix(#1352): moving the stop signal after svc.Run()
Browse files Browse the repository at this point in the history
Signed-off-by: Dinifarb <andreas.vogt89@bluewin.ch>
  • Loading branch information
DiniFarb committed Jan 7, 2024
1 parent 52b66bf commit 9921ba3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/initiate/initiate.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const (
serviceName = "windows_exporter"
)

type windowsExporterService struct {
stopCh chan<- bool
}
type windowsExporterService struct{}

var logger *eventlog.Log

Expand All @@ -39,7 +37,6 @@ loop:
}
}
}
s.stopCh <- true
return
}

Expand All @@ -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
}()
}()
}
}

0 comments on commit 9921ba3

Please sign in to comment.