Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Commit

Permalink
CancellationTokenSource in Cahe TagHelpers
Browse files Browse the repository at this point in the history
Fixes #5649
  • Loading branch information
sebastienros authored May 18, 2017
1 parent ece5e74 commit ce00ee0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
try
{
// The entry is set instead of assigning a value to the
// task so that the expiration options are are not impacted
// task so that the expiration options are not impacted
// by the time it took to compute it.

using (var entry = MemoryCache.CreateEntry(cacheKey))
Expand All @@ -122,6 +122,7 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
// If an exception occurs, ensure the other awaiters
// render the output by themselves.
tcs.SetResult(null);
tokenSource.Dispose();
}
}
else
Expand Down Expand Up @@ -240,4 +241,4 @@ public void WriteTo(TextWriter writer, HtmlEncoder encoder)
}
}
}
}
}

0 comments on commit ce00ee0

Please sign in to comment.