Skip to content

Commit

Permalink
We don't want to log if either the task OR the inner delay task are c…
Browse files Browse the repository at this point in the history
…anceled (#1758)
  • Loading branch information
jstnlef committed Sep 23, 2022
1 parent 6b34459 commit fb5d36b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Proto.Actor/Utils/TaskFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ public static class SafeTask
/// <param name="name"></param>
public static async Task Run(Func<Task> body, CancellationToken cancellationToken = default, [CallerMemberName] string name = "")
{
Task? t = null;
try
{
t = Task.Run(body, cancellationToken);
await t;
await Task.Run(body, cancellationToken);
}
catch (TaskCanceledException e) when (e.Task == t)
catch (TaskCanceledException)
{
//pass. do not log if our own task was cancelled
// Pass. Do not log when the task is canceled.
}
catch (Exception x)
{
Expand Down

0 comments on commit fb5d36b

Please sign in to comment.