From 9c359adf3710d6865cf110e25177db44313ff810 Mon Sep 17 00:00:00 2001 From: Daniel Marbach Date: Tue, 2 Jul 2024 18:00:18 +0200 Subject: [PATCH] Make the commit delay increment overridable (#330) Co-authored-by: Daniel Marbach --- .../ApprovalFiles/APIApprovals.Approve.approved.txt | 1 + src/NServiceBus.TransactionalSession/OpenSessionOptions.cs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/NServiceBus.TransactionalSession.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt b/src/NServiceBus.TransactionalSession.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt index b08cab5..404c627 100644 --- a/src/NServiceBus.TransactionalSession.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt +++ b/src/NServiceBus.TransactionalSession.Tests/ApprovalFiles/APIApprovals.Approve.approved.txt @@ -20,6 +20,7 @@ namespace NServiceBus.TransactionalSession public abstract class OpenSessionOptions { protected OpenSessionOptions() { } + public System.TimeSpan CommitDelayIncrement { get; set; } protected NServiceBus.Extensibility.ContextBag Extensions { get; } public System.TimeSpan MaximumCommitDuration { get; set; } public System.Collections.Generic.IDictionary Metadata { get; } diff --git a/src/NServiceBus.TransactionalSession/OpenSessionOptions.cs b/src/NServiceBus.TransactionalSession/OpenSessionOptions.cs index dc89e49..95c5423 100644 --- a/src/NServiceBus.TransactionalSession/OpenSessionOptions.cs +++ b/src/NServiceBus.TransactionalSession/OpenSessionOptions.cs @@ -31,9 +31,14 @@ public abstract class OpenSessionOptions /// The maximum duration the transaction is allowed to attempt to atomically commit. /// /// The actual total transaction time observed might be longer, taking into account delays in the transport due to latency, delayed delivery and more. + /// Defaults to TimeSpan.FromSeconds(15) public TimeSpan MaximumCommitDuration { get; set; } = TimeSpan.FromSeconds(15); - internal TimeSpan CommitDelayIncrement { get; set; } = TimeSpan.FromSeconds(2); + /// + /// The time increment used to delay the commit of the transactional session when the outbox record is not yet in the storage. + /// + /// Defaults to TimeSpan.FromSeconds(2) + public TimeSpan CommitDelayIncrement { get; set; } = TimeSpan.FromSeconds(2); Dictionary metadata; }