Skip to content

Commit

Permalink
fix: master node distributes large file upload requests causing OOM (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mycxu authored Nov 2, 2024
1 parent feb93c9 commit 5e8921d
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,10 @@ public FileLocation decideLocationForNewFile(UserEntity user, FileType type) {
@Override
public long forwardUploadRequestToStaticWorker(StaticWorkerEntity worker, FileType type, MultipartFile file) throws Throwable {
MultipartBodyBuilder builder = new MultipartBodyBuilder();
try {
builder.part("file", new ByteArrayResource(file.getBytes()))
.filename(file.getOriginalFilename() != null ? file.getOriginalFilename() : Constant.DEFAULT_FILENAME)
.contentType(MediaType.APPLICATION_OCTET_STREAM);
builder.part("type", type.name());
} catch (IOException e) {
throw new RuntimeException(e);
}
builder.part("file", file.getResource())
.filename(file.getOriginalFilename() != null ? file.getOriginalFilename() : Constant.DEFAULT_FILENAME)
.contentType(MediaType.APPLICATION_OCTET_STREAM);
builder.part("type", type.name());

UriBuilder uriBuilder = new DefaultUriBuilderFactory().builder()
.scheme("http")
Expand Down

0 comments on commit 5e8921d

Please sign in to comment.