2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2026-06-13 14:38:43 +00:00

Keep fanout sweep subscriptions alive

This commit is contained in:
2026-06-04 18:31:19 +03:00
parent 2963c0505b
commit d626bdb1ba
@@ -303,6 +303,7 @@ static async Task<SubscriberTask?> SpawnSubscriber(
for (int i = 0; i < resources; i++) for (int i = 0; i < resources; i++)
{ {
var proxy = await conn.Get($"sys/sensor_{i}"); var proxy = await conn.Get($"sys/sensor_{i}");
sub.Resources.Add(proxy);
long lastTick = Stopwatch.GetTimestamp(); long lastTick = Stopwatch.GetTimestamp();
proxy.Instance.PropertyModified += (PropertyModificationInfo data) => proxy.Instance.PropertyModified += (PropertyModificationInfo data) =>
@@ -385,6 +386,7 @@ static string GetArg(string[] args, string key, string def)
class SubscriberTask class SubscriberTask
{ {
public int SubscriberId; public int SubscriberId;
public readonly List<IResource> Resources = new();
internal long _received; internal long _received;
internal long _lateDeliveries; internal long _lateDeliveries;
public long Received => Interlocked.Read(ref _received); public long Received => Interlocked.Read(ref _received);
@@ -424,4 +426,4 @@ record SweepResult
public double MeanServerCpuPeak; public double MeanServerCpuPeak;
public double MeanClientCpuAvg; public double MeanClientCpuAvg;
public double MeanClientCpuPeak; public double MeanClientCpuPeak;
} }