fix(lmxproxy): await COM subscription creation to fix Subscribe flakiness
SubscriptionManager.Subscribe was fire-and-forgetting the MxAccess COM subscription creation. The initial OnDataChange callback could fire before the subscription was established, losing the first (and possibly only) value update. Changed to async SubscribeAsync that awaits CreateMxAccessSubscriptionsAsync before returning the channel reader. Subscribe_ReceivesUpdates now passes 5/5 consecutive runs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -104,7 +104,7 @@ namespace ZB.MOM.WW.LmxProxy.Host.Tests.Health
|
||||
for (int i = 0; i < 101; i++)
|
||||
{
|
||||
using var cts = new CancellationTokenSource();
|
||||
sm.Subscribe("client-" + i, new[] { "tag1" }, cts.Token);
|
||||
await sm.SubscribeAsync("client-" + i, new[] { "tag1" }, cts.Token);
|
||||
}
|
||||
|
||||
var svc = new HealthCheckService(client, sm, pm);
|
||||
|
||||
Reference in New Issue
Block a user