fix(siteeventlog): suppress snapshot-resync alarm re-emit + coverage + hardening (review)
This commit is contained in:
@@ -82,6 +82,18 @@ public class StoreAndForwardService
|
||||
/// recognisable instead of an unattributable empty string.
|
||||
/// </summary>
|
||||
public const string UnknownSiteSentinel = "$unknown-site";
|
||||
|
||||
/// <summary>
|
||||
/// M1.7: the detail-string prefix written by <see cref="EnqueueAsync"/>
|
||||
/// when an immediate forward attempt throws and the message is buffered for
|
||||
/// the retry sweep. <see cref="EmitSiteEvent"/> matches on this same prefix
|
||||
/// to distinguish a forward <i>failure</i> (logged) from a routine
|
||||
/// no-handler enqueue (not logged), so both the construction site and the
|
||||
/// check reference this single constant rather than duplicating the
|
||||
/// literal — keeping the two ends from drifting apart.
|
||||
/// </summary>
|
||||
private const string BufferedForRetryDetailPrefix = "Buffered for retry";
|
||||
|
||||
private Timer? _retryTimer;
|
||||
private int _retryInProgress;
|
||||
|
||||
@@ -261,11 +273,12 @@ public class StoreAndForwardService
|
||||
if (category == StoreAndForwardCategory.Notification)
|
||||
{
|
||||
// Spec: log only forward-failure (the immediate forward threw and the
|
||||
// notification was buffered for retry — detail "Buffered for retry:")
|
||||
// and park. A routine "No handler registered, buffered" enqueue and a
|
||||
// forward-success "Delivered" are deliberately NOT logged.
|
||||
// notification was buffered for retry — detail prefixed
|
||||
// BufferedForRetryDetailPrefix) and park. A routine "No handler
|
||||
// registered, buffered" enqueue and a forward-success "Delivered"
|
||||
// are deliberately NOT logged.
|
||||
var isForwardFailure = action == "Queued"
|
||||
&& detail.StartsWith("Buffered for retry", StringComparison.Ordinal);
|
||||
&& detail.StartsWith(BufferedForRetryDetailPrefix, StringComparison.Ordinal);
|
||||
if (!isForwardFailure && action != "Parked")
|
||||
{
|
||||
return;
|
||||
@@ -536,7 +549,7 @@ public class StoreAndForwardService
|
||||
message.LastError = ex.Message;
|
||||
await BufferAsync(message);
|
||||
|
||||
RaiseActivity("Queued", category, $"Buffered for retry: {target} ({ex.Message})");
|
||||
RaiseActivity("Queued", category, $"{BufferedForRetryDetailPrefix}: {target} ({ex.Message})");
|
||||
return new StoreAndForwardResult(true, message.Id, true);
|
||||
}
|
||||
}
|
||||
@@ -553,7 +566,7 @@ public class StoreAndForwardService
|
||||
await BufferAsync(message);
|
||||
RaiseActivity("Queued", category, attemptImmediateDelivery
|
||||
? $"No handler registered, buffered: {target}"
|
||||
: $"Buffered for retry: {target}");
|
||||
: $"{BufferedForRetryDetailPrefix}: {target}");
|
||||
return new StoreAndForwardResult(true, message.Id, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user