From d01af426db41991b17f763a79fdc19293e4c3a3c Mon Sep 17 00:00:00 2001 From: pancakes Date: Thu, 13 Mar 2025 11:39:57 +1000 Subject: [PATCH] [backend/api] Flush StreamWriter when exporting notes to drive file --- Iceshrimp.Backend/Core/Queues/BackgroundTaskQueue.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Iceshrimp.Backend/Core/Queues/BackgroundTaskQueue.cs b/Iceshrimp.Backend/Core/Queues/BackgroundTaskQueue.cs index 542d2282..6c89608b 100644 --- a/Iceshrimp.Backend/Core/Queues/BackgroundTaskQueue.cs +++ b/Iceshrimp.Backend/Core/Queues/BackgroundTaskQueue.cs @@ -426,9 +426,10 @@ public class BackgroundTaskQueue(int parallelism) }; var stream = new MemoryStream(); - await using var sr = new StreamWriter(stream); + await using var sw = new StreamWriter(stream); - await sr.WriteAsync(JsonSerializer.Serialize(notes, JsonSerialization.Options)); + await sw.WriteAsync(JsonSerializer.Serialize(notes, JsonSerialization.Options)); + await sw.FlushAsync(token); await driveSvc.StoreFileAsync(stream, user, request, true);