Finish: Phase 33 — Alert Quality Analytics

This commit is contained in:
voltsrage
2026-06-24 03:39:24 +08:00
parent 185dc93fa1
commit 68c397350b
26 changed files with 934 additions and 169 deletions
@@ -18,12 +18,12 @@ public static class RabbitMqTestHelper
using var connection = factory.CreateConnection("test-queue-purge");
using var channel = connection.CreateModel();
foreach (var queue in new[]
{
"alerts.paging.queue",
"alerts.paging.dlq",
"alerts.escalation.queue",
})
// x-message-ttl is immutable once the queue exists. A concurrently running dev API
// (300000 ms) can recreate the DLQ after the test host provisions 5000 ms, leaving
// escalation stuck until the 5-minute TTL expires — far beyond the test poll window.
RecreatePagingDlq(channel, o.PagingAckTimeoutMs);
foreach (var queue in new[] { "alerts.paging.queue", "alerts.escalation.queue" })
{
try
{
@@ -35,4 +35,35 @@ public static class RabbitMqTestHelper
}
}
}
private static void RecreatePagingDlq(IModel channel, int pagingAckTimeoutMs)
{
const string dlq = "alerts.paging.dlq";
try
{
channel.QueueDelete(dlq, ifUnused: false, ifEmpty: false);
}
catch (OperationInterruptedException)
{
// Queue may not exist yet on a cold broker.
}
channel.ExchangeDeclare(
RabbitMqTopologyProvisioner.Exchange,
ExchangeType.Direct,
durable: true);
channel.QueueDeclare(
queue: dlq,
durable: true,
exclusive: false,
autoDelete: false,
arguments: new Dictionary<string, object>
{
["x-message-ttl"] = pagingAckTimeoutMs,
["x-dead-letter-exchange"] = RabbitMqTopologyProvisioner.Exchange,
["x-dead-letter-routing-key"] = RabbitMqTopologyProvisioner.EscalKey,
});
}
}