From 51d6ed474b074b883df0842be338191cb1fc16dc Mon Sep 17 00:00:00 2001 From: James Gunn Date: Wed, 3 Jan 2024 16:07:45 +0000 Subject: [PATCH] Don't raise error when shutting down sync services --- .../Services/DqtReporting/DqtReportingService.cs | 4 ++++ .../Services/TrsDataSync/TrsDataSyncService.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Core/Services/DqtReporting/DqtReportingService.cs b/TeachingRecordSystem/src/TeachingRecordSystem.Core/Services/DqtReporting/DqtReportingService.cs index 25d07ac555..98ec31e329 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.Core/Services/DqtReporting/DqtReportingService.cs +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Core/Services/DqtReporting/DqtReportingService.cs @@ -146,6 +146,10 @@ await Parallel.ForEachAsync( { await ProcessChangesForEntityType(entityType, ct); } + catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested) + { + throw; + } catch (Exception ex) { throw new ProcessChangesException(entityType, ex); diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Core/Services/TrsDataSync/TrsDataSyncService.cs b/TeachingRecordSystem/src/TeachingRecordSystem.Core/Services/TrsDataSync/TrsDataSyncService.cs index 6fab1c17b8..25e211aca2 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.Core/Services/TrsDataSync/TrsDataSyncService.cs +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Core/Services/TrsDataSync/TrsDataSyncService.cs @@ -62,6 +62,10 @@ async Task SyncIfEnabled(string modelType) { await ProcessChangesForModelType(modelType, cancellationToken); } + catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested) + { + throw; + } catch (Exception ex) { throw new ProcessChangesException(modelType, ex);