Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard clauses for TimeoutPolicy now allow Timout.InfiniteTimeSpan (Issue #419) #424

Merged
merged 11 commits into from
Mar 30, 2018

Conversation

urig
Copy link
Contributor

@urig urig commented Mar 26, 2018

A TimeSpan value of Timeout.InfiniteTimeSpan indicates, well, an infinite timeout for the policy.

Please note this PR only addresses the sync version of the Policy. Async version to be address immediately following.

@dnfclas
Copy link

dnfclas commented Mar 26, 2018

CLA assistant check
All CLA requirements met.

@reisenberger
Copy link
Member

Thank you @urig , this is looking great!

Hmm. From the build error, it looks like .NET4.0 does not publicly expose the constant System.Threading.Timeout.InfiniteTimeSpan (altho my understanding is it behaves the same). So we may need to define our own constant:

internal static readonly TimeSpan InfiniteTimeSpan = System.Threading.Timeout.InfiniteTimeSpan;

and then use #if directive forking to just define it manually for .NET4.0. Probably pull that into a TimeoutSyntaxBase base class (thoughts?) along with the ValidateTimeoutIsInRange(...) method, as they'll be used across several syntax classes? (see below).

Let's also catch the:

/// <exception cref="System.ArgumentOutOfRangeException">

intellisense for the methods you're updating, update them to the nice new message from ValidateTimeoutIsInRange(...)!

I reckon that would be good to go then across the other syntax classes. There's a very similar TimeoutTResultSyntax.cs class for the generic (Policy<TResult>), synchronous versions of TimeoutPolicy. And then a similar pair (TimeoutSyntaxAsync.cs, TimeoutTResultSyntaxAsync.cs) for the async variants.

Thank you again for your contribution!

@urig
Copy link
Contributor Author

urig commented Mar 28, 2018

I have some questions about this. Will try to catch you on Slack!

@reisenberger reisenberger added this to the v5.9.0 milestone Mar 30, 2018
@reisenberger
Copy link
Member

Thanks @urig . Merging! Will add credit and v5.9.0 doco for this later.

@reisenberger reisenberger merged commit b82366f into App-vNext:master Mar 30, 2018
@reisenberger reisenberger mentioned this pull request Mar 30, 2018
reisenberger added a commit that referenced this pull request Apr 9, 2018
+ #424 (fixes #419) Allow `Timeout.InfiniteTimeSpan` for TimeoutPolicy
+ #425 Rationalise Execute()/ExecuteAsync() overloads: pre-advise ([per SemVer](https://semver.org/#how-should-i-handle-deprecating-functionality)) expected breaking changes for v6.0
+ #426 Better name ExecutionKey and ExecutionGuid: pre-advise ([per SemVer](https://semver.org/#how-should-i-handle-deprecating-functionality)) expected breaking changes for v6.0
+ Add `Context()` public noargs ctor
+ Minor corrections to method visibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants