You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Task returned by the GrainCancellationTokenSource.Cancel method does not complete until the cancellations sent to all in-progress grain methods invoked using a GrainCancellationToken attached to the GrainCancellationTokenSource all successfully complete, which I assume means once all cancellation messages have been acknowledged. This is a network operation subject to delays and timeouts, which means that the operation could take a long time to complete. Therefore, the operation should be cancelable.
I therefore propose that a GrainCancellationTokenSource.Cancel(CancellationToken) overload be added.
The cancellation operation should be immediately abandoned as soon as the given CancellationToken parameter is signaled. i.e., cancelling the cancellation operation does not mean sending cancellation messages to cancel the previously sent cancellation messages. It simply means to stop waiting for the previously sent cancellation messages to be acknowledged. Therefore, when the given CancellationToken parameter is signaled:
Any client-side in-progress grain method calls using a GrainCancellationToken attached to the GrainCancellationTokenSource all immediately complete, throwing an OperationCanceledException.
The GrainCancellationTokenSource.Cancel method immediately completes, throwing an OperationCanceledException.
Note that stopping an ASP.NET Core host process is signaled with two cancellation tokens. The first token is signaled when the host's StopAsync(CancellationToken) method is invoked and the second if/when the CancellationToken parameter passed to the StopAsync(CancellationToken) is canceled. It would make sense that the GrainCancellationTokenSource.Cancel(CancellationToken) method be invoked when the first cancellation token is signaled, passing the second cancellation token as the method parameter.
This would also allow grain methods to be instantly cancelled on the client side without sending cancellation messages or waiting for those messages to be acknowledged by invoking GrainCancellationTokenSource.Cancel(new(canceled: true)). It would also allow enforcing a timeout:
usingvargcts=new GrainCancellationTokenSource();// Invoke grain method(s)// Cancel grain method(s) with a five second timeout.vartimeout= TimeSpan.FromSeconds(5);usingvarcts=new CancellationTokenSource(timeout);await gcts.Cancel(cts.Token);
The text was updated successfully, but these errors were encountered:
The
Task
returned by theGrainCancellationTokenSource.Cancel
method does not complete until the cancellations sent to all in-progress grain methods invoked using aGrainCancellationToken
attached to theGrainCancellationTokenSource
all successfully complete, which I assume means once all cancellation messages have been acknowledged. This is a network operation subject to delays and timeouts, which means that the operation could take a long time to complete. Therefore, the operation should be cancelable.I therefore propose that a
GrainCancellationTokenSource.Cancel(CancellationToken)
overload be added.The cancellation operation should be immediately abandoned as soon as the given
CancellationToken
parameter is signaled. i.e., cancelling the cancellation operation does not mean sending cancellation messages to cancel the previously sent cancellation messages. It simply means to stop waiting for the previously sent cancellation messages to be acknowledged. Therefore, when the givenCancellationToken
parameter is signaled:GrainCancellationToken
attached to theGrainCancellationTokenSource
all immediately complete, throwing anOperationCanceledException
.GrainCancellationTokenSource.Cancel
method immediately completes, throwing anOperationCanceledException
.Note that stopping an ASP.NET Core host process is signaled with two cancellation tokens. The first token is signaled when the host's
StopAsync(CancellationToken)
method is invoked and the second if/when theCancellationToken
parameter passed to theStopAsync(CancellationToken)
is canceled. It would make sense that theGrainCancellationTokenSource.Cancel(CancellationToken)
method be invoked when the first cancellation token is signaled, passing the second cancellation token as the method parameter.This would also allow grain methods to be instantly cancelled on the client side without sending cancellation messages or waiting for those messages to be acknowledged by invoking
GrainCancellationTokenSource.Cancel(new(canceled: true))
. It would also allow enforcing a timeout:The text was updated successfully, but these errors were encountered: