Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: master node distributes large file upload requests causing OOM #310

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading