Skip to content

Commit d1bfc2f

Browse files
committed
Added FlushAsync on errors
1 parent 67e016f commit d1bfc2f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Services/Administration/OJS.Services.Administration.Business/Contests/ContestsImportBusinessService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public async Task StreamImportContestsFromCategory(int sourceContestCategoryId,
4848
if (sourceContestCategoryId == 0 || destinationContestCategoryId == 0)
4949
{
5050
await response.WriteAsync("<p style='color:red'>Invalid contest category ids.</p>");
51+
await response.Body.FlushAsync();
5152
return;
5253
}
5354

@@ -61,6 +62,7 @@ public async Task StreamImportContestsFromCategory(int sourceContestCategoryId,
6162
{
6263
await response.WriteAsync("<p style='color:red'>Failed to get contest IDs.</p>");
6364
await response.WriteAsync("</div>");
65+
await response.Body.FlushAsync();
6466
return;
6567
}
6668

@@ -70,6 +72,7 @@ public async Task StreamImportContestsFromCategory(int sourceContestCategoryId,
7072
{
7173
await response.WriteAsync($"<p style='color:red'>Destination contest category with id {destinationContestCategoryId} does not exist.</p>");
7274
await response.WriteAsync("</div>");
75+
await response.Body.FlushAsync();
7376
return;
7477
}
7578

@@ -155,7 +158,6 @@ public async Task StreamImportContestsFromCategory(int sourceContestCategoryId,
155158
// Update progress bar with JavaScript
156159
await response.WriteAsync($"<script>document.getElementById('progress').style.width = '{percentage}%';</script>");
157160
await response.WriteAsync($"<script>document.getElementById('progress-text').innerText = 'Processed: {processedCount} of {contestIds.Length}';</script>");
158-
159161
await response.Body.FlushAsync();
160162
}
161163

0 commit comments

Comments
 (0)