diff --git a/src/VirtualClient/VirtualClient.Monitors/FileUploadMonitor.cs b/src/VirtualClient/VirtualClient.Monitors/FileUploadMonitor.cs index 0798e452d..404260d95 100644 --- a/src/VirtualClient/VirtualClient.Monitors/FileUploadMonitor.cs +++ b/src/VirtualClient/VirtualClient.Monitors/FileUploadMonitor.cs @@ -89,6 +89,8 @@ private async Task ProcessFileUploadsAsync(IBlobManager blobManager, EventContex try { + await Task.Delay(this.ProcessingIntervalWaitTime, cancellationToken); + // We do not honor the cancellation token until ALL files have been processed. while (await this.UploadFilesAsync(blobManager, relatedContext)) { @@ -103,8 +105,6 @@ private async Task ProcessFileUploadsAsync(IBlobManager blobManager, EventContex // to process, we will exit. } } - - await Task.Delay(this.ProcessingIntervalWaitTime, cancellationToken); } catch (OperationCanceledException) {