oss 异步获取流,检查时间修改格式
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
02aebab5ea
commit
88c1bf7e76
|
|
@ -1046,7 +1046,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
{
|
{
|
||||||
abortToken.ThrowIfCancellationRequested();
|
abortToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
var studyTime = study.StudyTime?.ToString("yyyy-MM-dd HH:mm:ss") ?? "UnknownTime";
|
var studyTime = study.StudyTime?.ToString("yyyyMMdd_HHmmss") ?? "UnknownTime";
|
||||||
var modalitysStr = string.Join('_', study.SeriesList.Select(t => t.Modality).Distinct());
|
var modalitysStr = string.Join('_', study.SeriesList.Select(t => t.Modality).Distinct());
|
||||||
|
|
||||||
// ---------- DICOMDIR ----------
|
// ---------- DICOMDIR ----------
|
||||||
|
|
@ -1172,8 +1172,11 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await using var source = await _oSSService.GetStreamFromOSSAsync(instance.Path);
|
await using (var source = await _oSSService.GetStreamFromOSSAsync(instance.Path))
|
||||||
|
{
|
||||||
await source.CopyToAsync(entryStream, 32 * 1024, abortToken);
|
await source.CopyToAsync(entryStream, 32 * 1024, abortToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -544,19 +544,15 @@ public class OSSService : IOSSService
|
||||||
|
|
||||||
var pipe = new System.IO.Pipelines.Pipe();
|
var pipe = new System.IO.Pipelines.Pipe();
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var args = new GetObjectArgs()
|
var args = new GetObjectArgs()
|
||||||
.WithBucket(minIOConfig.BucketName)
|
.WithBucket(minIOConfig.BucketName)
|
||||||
.WithObject(ossRelativePath)
|
.WithObject(ossRelativePath)
|
||||||
.WithCallbackStream( stream =>
|
.WithCallbackStream(async stream => // ✅ 使用异步回调
|
||||||
{
|
{
|
||||||
stream.CopyTo(pipe.Writer.AsStream());
|
try
|
||||||
});
|
{
|
||||||
|
var pipeStream = pipe.Writer.AsStream();
|
||||||
await minioClient.GetObjectAsync(args);
|
await stream.CopyToAsync(pipeStream); // ✅ 使用异步CopyTo
|
||||||
await pipe.Writer.CompleteAsync();
|
await pipe.Writer.CompleteAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -566,9 +562,40 @@ public class OSSService : IOSSService
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await minioClient.GetObjectAsync(args);
|
||||||
return pipe.Reader.AsStream();
|
return pipe.Reader.AsStream();
|
||||||
|
|
||||||
|
#region 废弃2
|
||||||
|
|
||||||
|
//var pipe = new System.IO.Pipelines.Pipe();
|
||||||
|
|
||||||
|
//_ = Task.Run(async () =>
|
||||||
|
//{
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// var args = new GetObjectArgs()
|
||||||
|
// .WithBucket(minIOConfig.BucketName)
|
||||||
|
// .WithObject(ossRelativePath)
|
||||||
|
// .WithCallbackStream(stream =>
|
||||||
|
// {
|
||||||
|
// stream.CopyTo(pipe.Writer.AsStream());
|
||||||
|
// });
|
||||||
|
|
||||||
|
// await minioClient.GetObjectAsync(args);
|
||||||
|
// await pipe.Writer.CompleteAsync();
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// Log.Error($"minio 获取流错误:{ex.Message}");
|
||||||
|
// await pipe.Writer.CompleteAsync(ex);
|
||||||
|
// }
|
||||||
|
//});
|
||||||
|
|
||||||
|
|
||||||
|
//return pipe.Reader.AsStream();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 废弃
|
#region 废弃
|
||||||
|
|
||||||
//var memoryStream = new MemoryStream();
|
//var memoryStream = new MemoryStream();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue