Publish Zonghengjia Windows 0.4.1 client source
This commit is contained in:
@@ -7,10 +7,22 @@ internal static class ConnectionHealthSelfTest
|
||||
internal static int Run()
|
||||
{
|
||||
var checks = new Dictionary<string, bool>();
|
||||
checks["startup_accepts_verified_proxy_before_smart_learning_finishes"] =
|
||||
ConnectionStartupPolicy.Accept(proxyHealthy: true, businessHealthy: false);
|
||||
checks["startup_rejects_unverified_proxy_even_if_business_probe_is_inconclusive"] =
|
||||
!ConnectionStartupPolicy.Accept(proxyHealthy: false, businessHealthy: false);
|
||||
checks["smart_startup_grace_covers_bounded_learning_warmup"] =
|
||||
ConnectionStartupPolicy.InitialHealthGraceMilliseconds("smart") >= 20_000;
|
||||
checks["global_startup_keeps_short_health_grace"] =
|
||||
ConnectionStartupPolicy.InitialHealthGraceMilliseconds("global") == 5_000;
|
||||
var policy = new ConnectionHealthPolicy();
|
||||
policy.BeginCore(1_000);
|
||||
checks["new_core_has_short_background_grace"] = !policy.IsDue(5_999, true) && policy.IsDue(6_000, true);
|
||||
checks["dead_core_does_not_wait_for_probe_due"] = policy.IsDue(1_001, false);
|
||||
policy.BeginCore(10_000, ConnectionStartupPolicy.InitialHealthGraceMilliseconds("smart"));
|
||||
checks["smart_core_is_not_torn_down_while_learning_is_bounded"] =
|
||||
!policy.IsDue(29_999, true) && policy.IsDue(30_000, true);
|
||||
policy.BeginCore(1_000);
|
||||
var revision = policy.Revision;
|
||||
ConnectionHealthPolicy.Decision Observe(bool healthy, long now, int? core = 10)
|
||||
=> policy.Observe(policy.Revision, core, core, true, false, false, false, healthy, now);
|
||||
|
||||
Reference in New Issue
Block a user