fix(siteruntime): eagerly validate TagSubscribeRetryIntervalMs + StuckScriptGraceMs at boot (plan R2-03 T4)
This commit is contained in:
@@ -56,5 +56,14 @@ public sealed class SiteRuntimeOptionsValidator : OptionsValidatorBase<SiteRunti
|
|||||||
builder.RequireThat(options.ConfigFetchRetryCount >= 0,
|
builder.RequireThat(options.ConfigFetchRetryCount >= 0,
|
||||||
$"ScadaBridge:SiteRuntime:ConfigFetchRetryCount must be >= 0 " +
|
$"ScadaBridge:SiteRuntime:ConfigFetchRetryCount must be >= 0 " +
|
||||||
$"(was {options.ConfigFetchRetryCount}).");
|
$"(was {options.ConfigFetchRetryCount}).");
|
||||||
|
|
||||||
|
builder.RequireThat(options.TagSubscribeRetryIntervalMs > 0,
|
||||||
|
$"ScadaBridge:SiteRuntime:TagSubscribeRetryIntervalMs must be greater than 0 " +
|
||||||
|
$"(was {options.TagSubscribeRetryIntervalMs}); a zero interval hot-loops the tag-subscribe " +
|
||||||
|
"retry and a negative one throws inside the Instance Actor's retry scheduling.");
|
||||||
|
|
||||||
|
builder.RequireThat(options.StuckScriptGraceMs >= 0,
|
||||||
|
$"ScadaBridge:SiteRuntime:StuckScriptGraceMs must be >= 0 " +
|
||||||
|
$"(was {options.StuckScriptGraceMs}); a negative grace throws inside the stuck-script watchdog's delay.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,24 @@ public class SiteRuntimeOptionsValidatorTests
|
|||||||
Assert.Contains("ScriptExecutionThreadCount", result.FailureMessage);
|
Assert.Contains("ScriptExecutionThreadCount", result.FailureMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ZeroTagSubscribeRetryIntervalMs_IsRejected()
|
||||||
|
{
|
||||||
|
var result = Validate(new SiteRuntimeOptions { TagSubscribeRetryIntervalMs = 0 });
|
||||||
|
|
||||||
|
Assert.True(result.Failed);
|
||||||
|
Assert.Contains("TagSubscribeRetryIntervalMs", result.FailureMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void NegativeStuckScriptGraceMs_IsRejected()
|
||||||
|
{
|
||||||
|
var result = Validate(new SiteRuntimeOptions { StuckScriptGraceMs = -1 });
|
||||||
|
|
||||||
|
Assert.True(result.Failed);
|
||||||
|
Assert.Contains("StuckScriptGraceMs", result.FailureMessage);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ZeroStreamBufferSize_IsRejected()
|
public void ZeroStreamBufferSize_IsRejected()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user