Skip to content

Commit

Permalink
Fix race condition in file upload monitor (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
yangpanMS authored Nov 25, 2024
1 parent 65a7a0b commit ef4e806
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/VirtualClient/VirtualClient.Monitors/FileUploadMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand All @@ -103,8 +105,6 @@ private async Task ProcessFileUploadsAsync(IBlobManager blobManager, EventContex
// to process, we will exit.
}
}

await Task.Delay(this.ProcessingIntervalWaitTime, cancellationToken);
}
catch (OperationCanceledException)
{
Expand Down

0 comments on commit ef4e806

Please sign in to comment.