Skip to content

Commit

Permalink
Fixing delay issue when nx api is running slow.
Browse files Browse the repository at this point in the history
  • Loading branch information
Digitalroot committed Aug 26, 2023
1 parent dad8c3e commit b01b801
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Digitalroot.ModUploader/Digitalroot.ModUploader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<VersionPrefix>1.3.0</VersionPrefix>
<VersionPrefix>1.3.1</VersionPrefix>
<RestoreAdditionalProjectSources>
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json;
https://digitalroot-valheim-nuget.s3.us-west-2.amazonaws.com/index.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ private static ICommandHandler GetCommandHandler()
var totalChunks = GetChunkCount(archiveFile);

// Upload all chunks but the last one.
var _ = Parallel.For(1, totalChunks, new ParallelOptions { MaxDegreeOfParallelism = 2 }, RunUploadWorkFlow);
var r = Parallel.For(1, totalChunks, new ParallelOptions { MaxDegreeOfParallelism = 2 }, RunUploadWorkFlow);

while (!r.IsCompleted)
{
await Task.Delay(1000);
}

RunUploadWorkFlow(totalChunks); // Upload the last file chunk
_autoEvent.WaitOne();

Expand Down Expand Up @@ -167,6 +173,7 @@ async void RunUploadWorkFlow(int i)
Console.WriteLine($"{nameof(uploadFileChunk.ResponseModel.UploadFileHash)}: {uploadFileChunk.ResponseModel.UploadFileHash}".Pastel(ColorOptions.ErrorColor));
Console.WriteLine($"{nameof(uploadFileChunk.ResponseModel.Status)}: {uploadFileChunk.ResponseModel.Status}".Pastel(ColorOptions.ErrorColor));
Console.WriteLine($"{nameof(uploadFileChunk.ResponseModel.Uuid)}: {uploadFileChunk.ResponseModel.Uuid}".Pastel(ColorOptions.ErrorColor));
return;
}
else
{
Expand Down

0 comments on commit b01b801

Please sign in to comment.