Skip to content

Commit

Permalink
fix: add protection to download createdtask
Browse files Browse the repository at this point in the history
  • Loading branch information
ereali-aneo committed Sep 12, 2024
1 parent 3718678 commit 66f3ccb
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/TaskDumper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,19 @@ await File.WriteAllTextAsync(folder + "Subtasks.json",
await foreach (var result in resultsCreated)
{
results[result.ResultId] = result;
var createdResponse = resultClient.GetResult(new GetResultRequest
{
ResultId = taskResponse.Task.PayloadId,
});
// Put subtask results in var folder + "Results"
await File.WriteAllBytesAsync(Path.Combine(folder + "Results",
result.ResultId),
await resultClient.DownloadResultData(taskResponse.Task.SessionId,
result.ResultId,
CancellationToken.None) ?? Encoding.ASCII.GetBytes(""));
if (createdResponse.Result.Status == ResultStatus.Completed)
{
await File.WriteAllBytesAsync(Path.Combine(folder + "Results",
result.ResultId),
await resultClient.DownloadResultData(taskResponse.Task.SessionId,
result.ResultId,
CancellationToken.None) ?? Encoding.ASCII.GetBytes(""));
}
}

await File.WriteAllTextAsync(folder + "CreatedResults.json",
Expand Down

0 comments on commit 66f3ccb

Please sign in to comment.