diff --git a/src/WinSW.Core/Configuration/DefaultSettings.cs b/src/WinSW.Core/Configuration/DefaultSettings.cs index 0b8d49b..9878291 100644 --- a/src/WinSW.Core/Configuration/DefaultSettings.cs +++ b/src/WinSW.Core/Configuration/DefaultSettings.cs @@ -57,10 +57,6 @@ namespace WinSW.Configuration public string[] ServiceDependencies => new string[0]; - public TimeSpan WaitHint => TimeSpan.FromSeconds(15); - - public TimeSpan SleepTime => TimeSpan.FromSeconds(1); - public bool Interactive => false; // Logging diff --git a/src/WinSW.Core/Configuration/IWinSWConfiguration.cs b/src/WinSW.Core/Configuration/IWinSWConfiguration.cs index 4ad0221..1be8406 100644 --- a/src/WinSW.Core/Configuration/IWinSWConfiguration.cs +++ b/src/WinSW.Core/Configuration/IWinSWConfiguration.cs @@ -52,10 +52,6 @@ namespace WinSW.Configuration string[] ServiceDependencies { get; } - TimeSpan WaitHint { get; } - - TimeSpan SleepTime { get; } - bool Interactive { get; } // Logging diff --git a/src/WinSW.Core/ServiceDescriptor.cs b/src/WinSW.Core/ServiceDescriptor.cs index a6a2ca6..99b0e33 100644 --- a/src/WinSW.Core/ServiceDescriptor.cs +++ b/src/WinSW.Core/ServiceDescriptor.cs @@ -576,20 +576,6 @@ namespace WinSW /// public bool BeepOnShutdown => this.dom.SelectSingleNode("//beeponshutdown") != null; - /// - /// The estimated time required for a pending stop operation (default 15 secs). - /// Before the specified amount of time has elapsed, the service should make its next call to the SetServiceStatus function - /// with either an incremented checkPoint value or a change in currentState. (see http://msdn.microsoft.com/en-us/library/ms685996.aspx) - /// - public TimeSpan WaitHint => this.SingleTimeSpanElement(this.dom, "waithint", Defaults.WaitHint); - - /// - /// The time before the service should make its next call to the SetServiceStatus function - /// with an incremented checkPoint value (default 1 sec). - /// Do not wait longer than the wait hint. A good interval is one-tenth of the wait hint but not less than 1 second and not more than 10 seconds. - /// - public TimeSpan SleepTime => this.SingleTimeSpanElement(this.dom, "sleeptime", Defaults.SleepTime); - /// /// True if the service can interact with the desktop. /// diff --git a/src/WinSW.Tests/ServiceDescriptorTests.cs b/src/WinSW.Tests/ServiceDescriptorTests.cs index bd55051..d223428 100644 --- a/src/WinSW.Tests/ServiceDescriptorTests.cs +++ b/src/WinSW.Tests/ServiceDescriptorTests.cs @@ -307,52 +307,6 @@ $@" Assert.False(serviceDescriptor.AllowServiceAcountLogonRight); } - [Fact] - public void VerifyWaitHint_FullXML() - { - var sd = ConfigXmlBuilder.Create(this.output) - .WithTag("waithint", "20 min") - .ToServiceDescriptor(true); - Assert.Equal(TimeSpan.FromMinutes(20), sd.WaitHint); - } - - /// - /// Test for https://github.com/kohsuke/winsw/issues/159 - /// - [Fact] - public void VerifyWaitHint_XMLWithoutVersion() - { - var sd = ConfigXmlBuilder.Create(this.output, printXmlVersion: false) - .WithTag("waithint", "21 min") - .ToServiceDescriptor(true); - Assert.Equal(TimeSpan.FromMinutes(21), sd.WaitHint); - } - - [Fact] - public void VerifyWaitHint_XMLWithoutComment() - { - var sd = ConfigXmlBuilder.Create(this.output, xmlComment: null) - .WithTag("waithint", "22 min") - .ToServiceDescriptor(true); - Assert.Equal(TimeSpan.FromMinutes(22), sd.WaitHint); - } - - [Fact] - public void VerifyWaitHint_XMLWithoutVersionAndComment() - { - var sd = ConfigXmlBuilder.Create(this.output, xmlComment: null, printXmlVersion: false) - .WithTag("waithint", "23 min") - .ToServiceDescriptor(true); - Assert.Equal(TimeSpan.FromMinutes(23), sd.WaitHint); - } - - [Fact] - public void VerifySleepTime() - { - var sd = ConfigXmlBuilder.Create(this.output).WithTag("sleeptime", "3 hrs").ToServiceDescriptor(true); - Assert.Equal(TimeSpan.FromHours(3), sd.SleepTime); - } - [Fact] public void VerifyResetFailureAfter() { diff --git a/src/WinSW/WrapperService.cs b/src/WinSW/WrapperService.cs index e9ce54f..e66c2c7 100644 --- a/src/WinSW/WrapperService.cs +++ b/src/WinSW/WrapperService.cs @@ -398,9 +398,8 @@ namespace WinSW { this.SignalPending(); - int processWaitHint = (int)Math.Min(this.descriptor.SleepTime.TotalMilliseconds, int.MaxValue); - - while (!process.WaitForExit(processWaitHint)) + // A good interval is one-tenth of the wait hint but not less than 1 second and not more than 10 seconds. + while (!process.WaitForExit(1_500)) { this.SignalPending(); } @@ -408,9 +407,7 @@ namespace WinSW private void SignalPending() { - int serviceWaitHint = (int)Math.Min(this.descriptor.WaitHint.TotalMilliseconds, int.MaxValue); - - this.RequestAdditionalTime(serviceWaitHint); + this.RequestAdditionalTime(15_000); } private void SignalStopped()