Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto refresh #648

Merged
merged 1 commit into from
Aug 29, 2020
Merged

Auto refresh #648

merged 1 commit into from
Aug 29, 2020

Conversation

nxtn
Copy link
Contributor

@nxtn nxtn commented Aug 15, 2020

Fixes #256
Contributes to #297
Contributes to #606

Automatically refreshes service properties if the config file is newer when the service is started or a command with write access is executed.

Enabled by default. Specify <autoRefresh>false</autoRefresh> to override.

Known issues

The last write time of the registry key sometimes isn't updated (or is updated abnormally like the followings)... so you may end up with refreshing the service indefinitely.

> WinSW.NET461.exe stop
file     last modified at 2020-08-15 3:39:23
registry last modified at 2020-08-15 3:25:44
03:39:27,053 - Service 'ABCD (ABC)' was refreshed successfully.
03:39:27,073 - Stopping service 'ABCD (ABC)'...
03:39:27,077 - Service 'ABCD (ABC)' has already stopped.

> WinSW.NET461.exe stop
file     last modified at 2020-08-15 3:39:30
registry last modified at 2020-08-15 3:32:17
03:39:33,356 - Service 'ABCDE (ABC)' was refreshed successfully.
03:39:33,376 - Stopping service 'ABCDE (ABC)'...
03:39:33,381 - Service 'ABCDE (ABC)' has already stopped.

> WinSW.NET461.exe stop
file     last modified at 2020-08-15 3:39:30
registry last modified at 2020-08-15 3:32:23
03:40:35,601 - Service 'ABCDE (ABC)' was refreshed successfully.
03:40:35,621 - Stopping service 'ABCDE (ABC)'...
03:40:35,625 - Service 'ABCDE (ABC)' has already stopped.

/cc @ricardopolo @losvedir

@nxtn nxtn added this to the 3.x milestone Aug 15, 2020
@nxtn nxtn linked an issue Aug 19, 2020 that may be closed by this pull request
@nxtn nxtn marked this pull request as ready for review August 20, 2020 05:06
@nxtn nxtn requested a review from oleg-nenashev as a code owner August 20, 2020 05:06
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For diagnosability purposes, it would be great to compare with existing configs and to log messages when changes are detected. It could be done in future iterations as an improvements.

Please update documentation before merging

src/WinSW/Program.cs Show resolved Hide resolved
@nxtn nxtn merged commit 2fc786a into winsw:v3 Aug 29, 2020
@nxtn nxtn deleted the v3-autorefresh branch August 29, 2020 06:36
@ricardopolo
Copy link
Contributor

Is refresh command available in v2? We need to use it right now but 3 looks in Alpha :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pre-start argument
3 participants