This commit is contained in:
luke 2025-06-21 01:06:10 +08:00
parent 31da1625f5
commit 343472f5cb

View File

@ -57,13 +57,15 @@ public class MinioOSGatewayImpl implements ObjectStorageGateway {
@Override @Override
public void uploadFile(String bucket, String objectPath, MultipartFile file) throws Exception { public void uploadFile(String bucket, String objectPath, MultipartFile file) throws Exception {
long startMs = System.currentTimeMillis();
localMinioClient.putObject(PutObjectArgs.builder() localMinioClient.putObject(PutObjectArgs.builder()
.bucket(bucket) .bucket(bucket)
.object(objectPath) .object(objectPath)
.stream(file.getInputStream(), file.getSize(), -1) .stream(file.getInputStream(), file.getSize(), -1)
.contentType(Optional.ofNullable(file.getContentType()).orElse("application/octet-stream")) .contentType(Optional.ofNullable(file.getContentType()).orElse("application/octet-stream"))
.build()); .build());
log.info("上传成功: {}/{}", bucket, objectPath); long endMs = System.currentTimeMillis();
log.info("上传成功: {}/{}, takes: {} ms", bucket, objectPath, (endMs - startMs));
} }
@Override @Override