From c8d181e557ca57f73eaea6380fb0ceeb9562d92c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 5 Jun 2026 13:16:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0flush=20=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Helper/OSSService.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 4f7f12646..864f1642f 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -544,22 +544,23 @@ public class OSSService : IOSSService var args = new GetObjectArgs() .WithBucket(minIOConfig.BucketName) .WithObject(ossRelativePath) - .WithCallbackStream(stream => + .WithCallbackStream(async source => { - stream.CopyTo(pipe.Writer.AsStream()); + await source.CopyToAsync(pipe.Writer.AsStream()); + await pipe.Writer.FlushAsync(); }); await minioClient.GetObjectAsync(args); - await pipe.Writer.CompleteAsync(); } - catch (Exception ex) + finally { - await pipe.Writer.CompleteAsync(ex); + await pipe.Writer.CompleteAsync(); } }); return pipe.Reader.AsStream(); + #region 废弃2 //var pipe = new System.IO.Pipelines.Pipe();