minio 获取流调整
parent
2969306d1e
commit
dc1f95c75e
|
|
@ -1186,14 +1186,21 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
|||
}
|
||||
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
|
||||
{
|
||||
var httpClientHandler = new HttpClientHandler
|
||||
{
|
||||
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
|
||||
};
|
||||
|
||||
var minIOConfig = ObjectStoreServiceOptions.MinIO;
|
||||
|
||||
var minioClient = new MinioClient()
|
||||
.WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}")
|
||||
.WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey)
|
||||
.WithSSL(minIOConfig.UseSSL)
|
||||
.WithHttpClient(new HttpClient(httpClientHandler))
|
||||
.Build();
|
||||
|
||||
|
||||
var pipe = new System.IO.Pipelines.Pipe();
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
|
|
@ -1206,6 +1213,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
|||
.WithCallbackStream(stream =>
|
||||
{
|
||||
stream.CopyTo(pipe.Writer.AsStream());
|
||||
pipe.Writer.FlushAsync();
|
||||
});
|
||||
|
||||
await minioClient.GetObjectAsync(args);
|
||||
|
|
@ -1213,6 +1221,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"minio 获取流错误:{ex.Message}");
|
||||
await pipe.Writer.CompleteAsync(ex);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue