Skip to content

Commit

Permalink
ResourceInvoker faster task completion check
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams authored and rynowak committed Apr 15, 2019
1 parent 763720b commit 7a4400e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/Mvc/Mvc.Core/src/Infrastructure/ResourceInvoker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
filter);

var task = filter.OnAuthorizationAsync(authorizationContext);
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.AuthorizationAsyncEnd;
return task;
Expand Down Expand Up @@ -344,7 +344,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
filter);

var task = filter.OnResourceExecutionAsync(resourceExecutingContext, InvokeNextResourceFilterAwaitedAsync);
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ResourceAsyncEnd;
return task;
Expand Down Expand Up @@ -418,7 +418,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
}

var task = InvokeNextResourceFilter();
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ResourceSyncEnd;
return task;
Expand Down Expand Up @@ -463,7 +463,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is

_result = _resourceExecutingContext.Result;
var task = InvokeAlwaysRunResultFilters();
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ResourceEnd;
return task;
Expand Down Expand Up @@ -512,7 +512,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
case State.ExceptionAsyncBegin:
{
var task = InvokeNextExceptionFilterAsync();
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ExceptionAsyncResume;
return task;
Expand All @@ -539,7 +539,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
filter);

var task = filter.OnExceptionAsync(exceptionContext);
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ExceptionAsyncEnd;
return task;
Expand Down Expand Up @@ -579,7 +579,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
case State.ExceptionSyncBegin:
{
var task = InvokeNextExceptionFilterAsync();
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ExceptionSyncEnd;
return task;
Expand Down Expand Up @@ -650,7 +650,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
_result = _exceptionContext.Result;

var task = InvokeAlwaysRunResultFilters();
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ResourceInsideEnd;
return task;
Expand Down Expand Up @@ -683,7 +683,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
}

var task = InvokeResultFilters();
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ResourceInsideEnd;
return task;
Expand All @@ -694,7 +694,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
case State.ActionBegin:
{
var task = InvokeInnerFilterAsync();
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ActionEnd;
return task;
Expand All @@ -715,7 +715,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is

Debug.Assert(scope == Scope.Invoker || scope == Scope.Resource);
var task = InvokeResultFilters();
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ResourceInsideEnd;
return task;
Expand Down Expand Up @@ -916,7 +916,7 @@ private Task ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope,
filter);

var task = filter.OnResultExecutionAsync(resultExecutingContext, InvokeNextResultFilterAwaitedAsync<TFilter, TFilterAsync>);
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ResultAsyncEnd;
return task;
Expand Down Expand Up @@ -998,7 +998,7 @@ private Task ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope,
}

var task = InvokeNextResultFilterAsync<TFilter, TFilterAsync>();
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ResultSyncEnd;
return task;
Expand Down Expand Up @@ -1048,7 +1048,7 @@ private Task ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope,
}

var task = InvokeResultAsync(_result);
if (task.Status != TaskStatus.RanToCompletion)
if (!task.IsCompletedSuccessfully)
{
next = State.ResultEnd;
return task;
Expand Down

0 comments on commit 7a4400e

Please sign in to comment.