mirror of https://github.com/winsw/winsw
Remove `<waithint>` and `<sleeptime>`
parent
08c836ccc5
commit
5e50ed79d0
|
@ -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
|
||||
|
|
|
@ -52,10 +52,6 @@ namespace WinSW.Configuration
|
|||
|
||||
string[] ServiceDependencies { get; }
|
||||
|
||||
TimeSpan WaitHint { get; }
|
||||
|
||||
TimeSpan SleepTime { get; }
|
||||
|
||||
bool Interactive { get; }
|
||||
|
||||
// Logging
|
||||
|
|
|
@ -576,20 +576,6 @@ namespace WinSW
|
|||
/// </summary>
|
||||
public bool BeepOnShutdown => this.dom.SelectSingleNode("//beeponshutdown") != null;
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
/// </summary>
|
||||
public TimeSpan WaitHint => this.SingleTimeSpanElement(this.dom, "waithint", Defaults.WaitHint);
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public TimeSpan SleepTime => this.SingleTimeSpanElement(this.dom, "sleeptime", Defaults.SleepTime);
|
||||
|
||||
/// <summary>
|
||||
/// True if the service can interact with the desktop.
|
||||
/// </summary>
|
||||
|
|
|
@ -307,52 +307,6 @@ $@"<service>
|
|||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test for https://github.com/kohsuke/winsw/issues/159
|
||||
/// </summary>
|
||||
[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()
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue