改成内存流测试
continuous-integration/drone/push Build is running Details

Test_HIR_Net8
hang 2026-06-05 13:37:11 +08:00
parent c8d181e557
commit 5a27fbc127
1 changed files with 35 additions and 30 deletions

View File

@ -535,30 +535,35 @@ public class OSSService : IOSSService
.WithSSL(minIOConfig.UseSSL) .WithSSL(minIOConfig.UseSSL)
.Build(); .Build();
var pipe = new System.IO.Pipelines.Pipe(); #region 废弃3
_ = Task.Run(async () => //var pipe = new System.IO.Pipelines.Pipe();
{
try
{
var args = new GetObjectArgs()
.WithBucket(minIOConfig.BucketName)
.WithObject(ossRelativePath)
.WithCallbackStream(async source =>
{
await source.CopyToAsync(pipe.Writer.AsStream());
await pipe.Writer.FlushAsync();
});
await minioClient.GetObjectAsync(args); //_ = Task.Run(async () =>
} //{
finally // try
{ // {
await pipe.Writer.CompleteAsync(); // var args = new GetObjectArgs()
} // .WithBucket(minIOConfig.BucketName)
}); // .WithObject(ossRelativePath)
// .WithCallbackStream(async source =>
// {
// await source.CopyToAsync(pipe.Writer.AsStream());
// await pipe.Writer.FlushAsync();
// });
// await minioClient.GetObjectAsync(args);
// }
// finally
// {
// await pipe.Writer.CompleteAsync();
// }
//});
//return pipe.Reader.AsStream();
#endregion
return pipe.Reader.AsStream();
#region 废弃2 #region 废弃2
@ -594,16 +599,16 @@ public class OSSService : IOSSService
#region 废弃 #region 废弃
//var memoryStream = new MemoryStream(); var memoryStream = new MemoryStream();
//var getObjectArgs = new GetObjectArgs() var getObjectArgs = new GetObjectArgs()
// .WithBucket(minIOConfig.BucketName) .WithBucket(minIOConfig.BucketName)
// .WithObject(ossRelativePath) .WithObject(ossRelativePath)
// .WithCallbackStream(stream => stream.CopyToAsync(memoryStream)); .WithCallbackStream(stream => stream.CopyToAsync(memoryStream));
//await minioClient.GetObjectAsync(getObjectArgs); await minioClient.GetObjectAsync(getObjectArgs);
//memoryStream.Position = 0; memoryStream.Position = 0;
//return memoryStream; return memoryStream;
#endregion #endregion