From d3a70b4c1dceb8c065002e853e11bd55c1c16326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gurhem?= Date: Wed, 13 Nov 2024 15:29:14 +0100 Subject: [PATCH] fix: catch TaskCanceledException when cancellation token is triggered while writing taskhandler in pollster --- Common/src/Pollster/Pollster.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Common/src/Pollster/Pollster.cs b/Common/src/Pollster/Pollster.cs index bf098cf3a..2ae52e068 100644 --- a/Common/src/Pollster/Pollster.cs +++ b/Common/src/Pollster/Pollster.cs @@ -383,10 +383,15 @@ await runningTaskQueue_.WriteAsync(taskHandler, // So remove the automatic dispose of the TaskHandler taskHandlerDispose.Reset(); } - catch (TimeoutException) + catch (Exception e) { await taskHandler.ReleaseAndPostponeTask() .ConfigureAwait(false); + + if (e is not (TimeoutException or OperationCanceledException)) + { + throw; + } } } catch (Exception e)