-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Fix some issues with Ignitor #15276
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
Fix some issues with Ignitor #15276
Conversation
pranavkm
commented
Oct 22, 2019
- Avoid null ref when FormatException is not set
- Handle errors when the client is canceled but an operation is in progress
* Avoid null ref when FormatException is not set * Handle errors when the client is canceled but an operation is in progress
namespace Ignitor | ||
{ | ||
internal class CancellableOperation<TResult> | ||
{ | ||
public CancellableOperation(TimeSpan? timeout) | ||
public CancellableOperation(TimeSpan? timeout, CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bulk of the interesting changes are localized to this type. Here's what happens:
- We start a
PrepareForNextBatch
- In the meanwhile,
BlazorClient.Cancel
is invoked (the server may or may not be dead at this point) CancellableOperation
knows nothing about this and eventually times out.
This change associates the BlazorClient.Cancel
with the operation and no-ops if the client has been cancelled
@@ -233,7 +236,7 @@ private async Task<CapturedRenderBatch> WaitForRenderBatch(TimeSpan? timeout = n | |||
{ | |||
return await PrepareForNextBatch(timeout ?? DefaultOperationTimeout); | |||
} | |||
catch (OperationCanceledException) | |||
catch (TimeoutException) when (FormatError != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a pain to discover: FomatError
isn't set up in the benchmarks repo. Took me forever to figure out was causing a null ref.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pranavkm What is format error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a callback used in the test to pretty print the exception + log: https://github.com/aspnet/AspNetCore/blob/master/src/Components/test/E2ETest/ServerExecutionTests/IgnitorTest.cs#L59-L63.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great improvements!