refactor: svc.Run() as main routine blocker #1372
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Regarding Issue #1352
I have made some tests with
svc.Run()
in the main Go routine here: DiniFarb@16888c2#diff-88d237fa0e6dd92a26d0dd0a14ad18246fb0924b68520062e9c9150e2004d7feWith that change, I could no longer reproduce the stop error.
In that commit, the Windows service interface is initialized after the whole windows_exporter has already started. But the interface should actually be initialized as early as possible, so that the
svc.Status{State: svc.StartPending}
can be sent back before most of the service is loaded. Thus, I have refactored the startup process while I tried the following order:I know that this is not a small change, so I am very open to changing things to keep a better understanding of the startup process for everyone. :)