perf: pool SubList match builders and cleanup scans

This commit is contained in:
Joseph Doherty
2026-03-13 10:06:24 -04:00
parent 5876ad7dfa
commit 0126234fa6
3 changed files with 202 additions and 29 deletions

View File

@@ -45,4 +45,20 @@ public class SubListAllocationGuardTests
matches.Count.ShouldBe(4);
matches.ShouldAllBe(match => match.Queue == "workers");
}
[Fact]
public void Match_merges_queue_groups_from_multiple_matching_nodes_by_queue_name()
{
using var sl = new SubList();
sl.Insert(new Subscription { Subject = "orders.created", Queue = "workers", Sid = "1" });
sl.Insert(new Subscription { Subject = "orders.*", Queue = "workers", Sid = "2" });
sl.Insert(new Subscription { Subject = "orders.>", Queue = "audit", Sid = "3" });
var result = sl.Match("orders.created");
result.PlainSubs.ShouldBeEmpty();
result.QueueSubs.Length.ShouldBe(2);
result.QueueSubs.Single(group => group[0].Queue == "workers").Length.ShouldBe(2);
result.QueueSubs.Single(group => group[0].Queue == "audit").Length.ShouldBe(1);
}
}