Skip to content

Commit

Permalink
Ignore OperationCanceledException in SafeTask (#2140)
Browse files Browse the repository at this point in the history
  • Loading branch information
mugu-1 authored Nov 7, 2024
1 parent eaac059 commit 87f19b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Proto.Actor/Utils/TaskFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class SafeTask
private static readonly ILogger Logger = Log.CreateLogger<TaskFactory>();

/// <summary>
/// Runs a task and handles exceptions. If <see cref="TaskCanceledException" /> is thrown, it is ignored.
/// Runs a task and handles exceptions. If <see cref="TaskCanceledException" /> or <see cref="OperationCanceledException"/> is thrown, it is ignored.
/// If any other exception is thrown, it is logged.
/// </summary>
/// <param name="body"></param>
Expand All @@ -34,6 +34,10 @@ public static async Task Run(Func<Task> body, CancellationToken cancellationToke
{
// Pass. Do not log when the task is canceled.
}
catch (OperationCanceledException)
{
// Pass. Do not log when the operation is canceled.
}
catch (Exception x)
{
x.CheckFailFast();
Expand Down

0 comments on commit 87f19b1

Please sign in to comment.