Skip to content

Commit 87f19b1

Browse files
authored
Ignore OperationCanceledException in SafeTask (#2140)
1 parent eaac059 commit 87f19b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Proto.Actor/Utils/TaskFactory.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static class SafeTask
1717
private static readonly ILogger Logger = Log.CreateLogger<TaskFactory>();
1818

1919
/// <summary>
20-
/// Runs a task and handles exceptions. If <see cref="TaskCanceledException" /> is thrown, it is ignored.
20+
/// Runs a task and handles exceptions. If <see cref="TaskCanceledException" /> or <see cref="OperationCanceledException"/> is thrown, it is ignored.
2121
/// If any other exception is thrown, it is logged.
2222
/// </summary>
2323
/// <param name="body"></param>
@@ -34,6 +34,10 @@ public static async Task Run(Func<Task> body, CancellationToken cancellationToke
3434
{
3535
// Pass. Do not log when the task is canceled.
3636
}
37+
catch (OperationCanceledException)
38+
{
39+
// Pass. Do not log when the operation is canceled.
40+
}
3741
catch (Exception x)
3842
{
3943
x.CheckFailFast();

0 commit comments

Comments
 (0)