perf(notification-outbox): bounded parallel delivery within a dispatch sweep (default 4)
This commit is contained in:
@@ -48,4 +48,23 @@ public class NotificationOutboxOptions
|
||||
/// Default: 1 minute.
|
||||
/// </summary>
|
||||
public TimeSpan DeliveredKpiWindow { get; set; } = TimeSpan.FromMinutes(1);
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of notifications delivered concurrently within a single dispatch
|
||||
/// sweep. Delivery is I/O-bound (SMTP / Twilio round trips of seconds each), so a
|
||||
/// purely sequential sweep caps throughput at ~1/attempt-latency regardless of batch
|
||||
/// size — an alarm storm queued behind one slow SMTP host would drain far too slowly
|
||||
/// (arch-review 04). Each concurrent delivery runs on its own DI scope/repository, so
|
||||
/// there is no shared-DbContext contention. Set to <c>1</c> to preserve the strictly
|
||||
/// sequential behaviour. Clamped to a minimum of 1 via <see cref="ResolvedMaxParallelDeliveries"/>.
|
||||
/// Default: 4.
|
||||
/// </summary>
|
||||
public int MaxParallelDeliveries { get; set; } = 4;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the effective delivery parallelism, clamped to at least 1 so a
|
||||
/// misconfigured <c>0</c>/negative value cannot stall the dispatcher (a zero-count
|
||||
/// semaphore would deadlock the sweep).
|
||||
/// </summary>
|
||||
public int ResolvedMaxParallelDeliveries => MaxParallelDeliveries < 1 ? 1 : MaxParallelDeliveries;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user