Ensure that CommitDelayIncrement is greater than TimeSpan.Zero#531
Ensure that CommitDelayIncrement is greater than TimeSpan.Zero#531hazel-bohon merged 6 commits intomainfrom
Conversation
…t to a negative value in OpenSessionOptions, and add an acceptance test to verify that an exception is thrown to the session user when CommitDelayIncrement is set to zero.
|
Some alternatives that reviewers might think about:
|
There was a problem hiding this comment.
The change here directly addresses the issues that were being seen.
I was looking into how and where this value actually ends up being used to see if this fix would be sufficient for any underlying issues. I ran across https://github.com/Particular/NServiceBus/blob/master/src/NServiceBus.Core/DelayedDelivery/DelayDeliveryWith.cs which only checks that it's not less than zero. I'm wondering if other places that cascade out could also have these issues hidden.
Also maybe not relevant for this PR, but I think it would be interesting to see why a duration of 0 was actually causing issues internally.
Edit: After looking at the alternate proposed solution, it makes a lot more sense why the value of 0 would be problematic coming from this context. The point above about DelayDeliveryWith still stands.
…ests.cs Co-authored-by: Tamara Rivera <tamita.rivera@gmail.com>
danielmarbach
left a comment
There was a problem hiding this comment.
Nice find!
Past me thinking: Sure, we can just ship without validation, and it will be fine.
- Syntax fix - Add unit test for `TimeSpan.FromTicks(1)` - Update exception to use dotnet library standard interfaces.
* Throw argument out of range exception when CommitDelayIncrement is set to a negative value in OpenSessionOptions, and add an acceptance test to verify that an exception is thrown to the session user when CommitDelayIncrement is set to zero. Co-authored-by: Tamara Rivera <tamita.rivera@gmail.com>
* Throw argument out of range exception when CommitDelayIncrement is set to a negative value in OpenSessionOptions, and add an acceptance test to verify that an exception is thrown to the session user when CommitDelayIncrement is set to zero. Co-authored-by: Tamara Rivera <tamita.rivera@gmail.com>
* Fix flaky test (#534) * Add check to ensure that TestMessage is given time to be audited. * Ensure that CommitDelayIncrement is greater than TimeSpan.Zero (#531) * Throw argument out of range exception when CommitDelayIncrement is set to a negative value in OpenSessionOptions, and add an acceptance test to verify that an exception is thrown to the session user when CommitDelayIncrement is set to zero. Co-authored-by: Tamara Rivera <tamita.rivera@gmail.com> --------- Co-authored-by: Tamara Rivera <tamita.rivera@gmail.com>
CommitDelayIncrementis greater thanTimeSpan.Zero.