From 9e8fb3afa6ae7dda2e41aec6a955c6eccdf5cc82 Mon Sep 17 00:00:00 2001 From: "bojan.malinic" Date: Wed, 3 Apr 2024 12:37:05 +0200 Subject: [PATCH] Handle task canceled exception --- .../Service/WorkflowEngineBackgroundService.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs b/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs index 809ca4b4..e78eaeec 100644 --- a/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs +++ b/src/ConductorSharp.Engine/Service/WorkflowEngineBackgroundService.cs @@ -1,5 +1,6 @@ using System; using System.Threading; +using System.Threading.Tasks; using ConductorSharp.Client.Generated; using ConductorSharp.Engine.Health; using ConductorSharp.Engine.Interface; @@ -46,6 +47,10 @@ private async Task RunAsync(CancellationToken cancellationToken) await _healthService.SetExecutionManagerRunning(cancellationToken); await _executionManager.StartAsync(cancellationToken); } + catch (TaskCanceledException) + { + _logger.LogInformation("Stopping ConductorSharp background service"); + } catch (ApiException exception) { await _healthService.UnsetExecutionManagerRunning(cancellationToken);